{"id":23099412,"url":"https://github.com/maurolepore/loaddata","last_synced_at":"2025-07-04T10:04:10.346Z","repository":{"id":89221742,"uuid":"127811356","full_name":"maurolepore/loaddata","owner":"maurolepore","description":"Load external data from a .csv file into a data frame (5' training for The Carpentries)","archived":false,"fork":false,"pushed_at":"2021-10-30T02:47:03.000Z","size":333,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T08:41:21.902Z","etag":null,"topics":["carpentries","carpentry","instructors","r","rmarkdown","training"],"latest_commit_sha":null,"homepage":"http://bit.ly/carpentry-loaddata","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maurolepore.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-02T20:54:03.000Z","updated_at":"2021-10-30T02:47:06.000Z","dependencies_parsed_at":"2023-06-14T12:00:38.191Z","dependency_job_id":null,"html_url":"https://github.com/maurolepore/loaddata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurolepore%2Floaddata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurolepore%2Floaddata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurolepore%2Floaddata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurolepore%2Floaddata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maurolepore","download_url":"https://codeload.github.com/maurolepore/loaddata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247072697,"owners_count":20878932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carpentries","carpentry","instructors","r","rmarkdown","training"],"created_at":"2024-12-16T23:19:07.460Z","updated_at":"2025-04-03T20:26:06.279Z","avatar_url":"https://github.com/maurolepore.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"Load external data from a .csv file into a data frame\"\noutput: \n github_document:\n   toc: true\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(\n  echo = TRUE,\n  comment = \"#\u003e\",\n  collapse = TRUE\n)\n```\n\n---\n\n## See https://bit.ly/carpentry-slides\n\n## Try by intuition\n\nDocument what you did.\n\n```{r}\n# Some code goes here\n\n```\n\n# Back to the lesson\n\n\u003e To download the data into the data/ subdirectory, run the following:\n\nWARNING: This will fail. Why? (Run and read the error message)\n\nHint: \n* Look in the Files tab. What's missing?\n* What are the first two arguments of `download.file()`?\n    * Find out with the help of autocompletion (press TAB) or with `?`\n\n```{r download-problem, error=TRUE}\n# MISTERY-FUNCTION-GOES-HERE(\"data\")\n\ndownload.file(\n  \"https://ndownloader.figshare.com/files/2292169\",\n  \"data/portal_data_joined.csv\"\n)\n```\n\n```{r download-solution, echo=FALSE}\n# MISTERY-FUNCTION-GOES-HERE(\"data\")\n# TODO REMOVE\ndir.create(\"data\")\n\ndownload.file(\n  \"https://ndownloader.figshare.com/files/2292169\",\n  \"data/portal_data_joined.csv\"\n)\n```\n\n\u003e You are now ready to load the data:\n\n```{r}\nsurveys \u003c- read.csv(\"data/portal_data_joined.csv\")\n```\n\n\u003e Print the variable's value: `surveys`\n\n```{r, eval=FALSE}\n# WARNING: In the console, this prints looooong output\nsurveys\n```\n\n\u003e Let's check the top (the first 6 lines) of this data frame using the function `head()`:\n\n```{r}\nhead(surveys)\n```\n\n# Thank you\n\n* https://bit.ly/carpentry-slides\n* https://bit.ly/mauro_lepore\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurolepore%2Floaddata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaurolepore%2Floaddata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurolepore%2Floaddata/lists"}