{"action":"created","comment":{"url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/comments/170039777","pull_request_review_id":98664649,"id":170039777,"diff_hunk":"@@ -0,0 +1,447 @@\n+---\n+title: \"dplyr\"\n+author:\n+- Damiano Oldoni\n+- Peter Desmet\n+- Stijn Van Hoey\n+- Lien Reyserhove\n+date: \"`r Sys.Date()`\"\n+output:\n+  html_document:\n+    toc: true\n+    toc_depth: 3\n+    toc_float: true\n+    number_sections: true\n+    theme: yeti\n+    df_print: paged\n+knit: (function(input_file, encoding) { rmarkdown::render(input_file, encoding = encoding, output_file = paste0(\"./docs/\",sub(\".Rmd\", \".html\", basename(input_file))))})\n+---\n+\n+```{r setup, include=FALSE}\n+knitr::opts_chunk$set(include = FALSE)\n+```\n+\n+This tutorial will provide you the know-how for importing and analysing (tidy) data. We will use the same dataframe to test the most typical dplyr functionlalities. There is no better way to improve your programming skills than trying it yourself.\n+\n+First of all, we need to load some libraries which are part of the tidyr package:\n+\n+```{r read data, echo = TRUE}\n+library(readr)\n+```\n+\n+```{r manipulate data, echo = TRUE}\n+library(dplyr)\n+library(tidyr)\n+library(magrittr)\n+```\n+\n+## Read data\n+First of all, we need to import data in R. The most user friendly way to do it is by using the interface provided by RStudio. In the Environment window, click on *Import Dataset* and select *From Text (readr)...*. A window will pop-up. Follow the next steps:\n+- click on *Browse* to selet the text file you want to import,\n+- select the right delimiter,\n+- check whether the class of the column values fits your purpose and in case apply changes by clicking on the class name below the column name,\n+- change variable name in *code preview* if you prefer to save the data with a different name than filename,\n+- click on *Import*\n+A dataframe is automatically generated and, very handy, the code to generate it too!\n+\n+### Exercise\n+1. Read `survey_data_spreadsheet_tidy.csv`. Check whether the columns match the following types\n+  * `date`: `double`\n+  * `species`: `character`\n+  * `plot`: `integer`\n+  * `sex`: `character`\n+  * `weight_in_g`: `integer`\n+  * `device_remarks`: `character`\n+2. save the data into `data`\n+```{r read and save data}\n+data <- read_delim(\"../data/interim/survey_data_spreadsheet_tidy.csv\", \";\", \n+           escape_double = FALSE, \n+           trim_ws = TRUE)\n+```\n+\n+\n+## Explore data\n+Before to start manipulate data, it is best practice exploring the imported dataframe in order to check whether everything is corectly imported and to have an idea about the data we are going to analyse/manipulate. R gives us several tools to do it:\n+\n+* **view(df)** opens the entire dataframe in viewer\n+* **head(df)** returns the first part of a data frame. It works with several other data types (vectors, tables, ...). Specifiy how many rows to display with parameter `n`: `haed(df, n = )`, default `n = 6`\n+* **str(df)** displays the internal structure of the dataframe","path":"docs/dplyr.Rmd","position":null,"original_position":68,"commit_id":"e193db4580c2fb9a37f24f3d91374e9b6fa9f654","original_commit_id":"6e1ff2b14b4529ff9afa341479998e7d9ba076b1","user":{"login":"damianooldoni","id":33662631,"avatar_url":"https://avatars1.githubusercontent.com/u/33662631?v=4","gravatar_id":"","url":"https://api.github.com/users/damianooldoni","html_url":"https://github.com/damianooldoni","followers_url":"https://api.github.com/users/damianooldoni/followers","following_url":"https://api.github.com/users/damianooldoni/following{/other_user}","gists_url":"https://api.github.com/users/damianooldoni/gists{/gist_id}","starred_url":"https://api.github.com/users/damianooldoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianooldoni/subscriptions","organizations_url":"https://api.github.com/users/damianooldoni/orgs","repos_url":"https://api.github.com/users/damianooldoni/repos","events_url":"https://api.github.com/users/damianooldoni/events{/privacy}","received_events_url":"https://api.github.com/users/damianooldoni/received_events","type":"User","site_admin":false},"body":"Nice: `class(df)` added, indeed. However, I did not remove `str(df)`: it is just a list of tools, they use what they feel more useful. Implemented here: ea9ff1b7d0c6f9e371e049609c90eb59aae9ea5a","created_at":"2018-02-22T17:48:12Z","updated_at":"2018-02-22T17:48:12Z","html_url":"https://github.com/inbo/dwc-in-R/pull/2#discussion_r170039777","pull_request_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/comments/170039777"},"html":{"href":"https://github.com/inbo/dwc-in-R/pull/2#discussion_r170039777"},"pull_request":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2"}},"in_reply_to_id":169115167},"pull_request":{"url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2","id":169830829,"html_url":"https://github.com/inbo/dwc-in-R/pull/2","diff_url":"https://github.com/inbo/dwc-in-R/pull/2.diff","patch_url":"https://github.com/inbo/dwc-in-R/pull/2.patch","issue_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/2","number":2,"state":"open","locked":false,"title":"write dplyr.rmd completed","user":{"login":"damianooldoni","id":33662631,"avatar_url":"https://avatars1.githubusercontent.com/u/33662631?v=4","gravatar_id":"","url":"https://api.github.com/users/damianooldoni","html_url":"https://github.com/damianooldoni","followers_url":"https://api.github.com/users/damianooldoni/followers","following_url":"https://api.github.com/users/damianooldoni/following{/other_user}","gists_url":"https://api.github.com/users/damianooldoni/gists{/gist_id}","starred_url":"https://api.github.com/users/damianooldoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianooldoni/subscriptions","organizations_url":"https://api.github.com/users/damianooldoni/orgs","repos_url":"https://api.github.com/users/damianooldoni/repos","events_url":"https://api.github.com/users/damianooldoni/events{/privacy}","received_events_url":"https://api.github.com/users/damianooldoni/received_events","type":"User","site_admin":false},"body":"I wrote the tutorial dplyr.rmd. Reviews are more than welcome!\r\nI knitted it too to check the result. How avoid starting chapters count from 0?\r\nThanks.","created_at":"2018-02-18T13:39:38Z","updated_at":"2018-02-22T17:48:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66fbf3c866d6a456bbe791559241a950b802fef0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"peterdesmet","id":600993,"avatar_url":"https://avatars3.githubusercontent.com/u/600993?v=4","gravatar_id":"","url":"https://api.github.com/users/peterdesmet","html_url":"https://github.com/peterdesmet","followers_url":"https://api.github.com/users/peterdesmet/followers","following_url":"https://api.github.com/users/peterdesmet/following{/other_user}","gists_url":"https://api.github.com/users/peterdesmet/gists{/gist_id}","starred_url":"https://api.github.com/users/peterdesmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterdesmet/subscriptions","organizations_url":"https://api.github.com/users/peterdesmet/orgs","repos_url":"https://api.github.com/users/peterdesmet/repos","events_url":"https://api.github.com/users/peterdesmet/events{/privacy}","received_events_url":"https://api.github.com/users/peterdesmet/received_events","type":"User","site_admin":false},{"login":"milotictanja","id":26165229,"avatar_url":"https://avatars3.githubusercontent.com/u/26165229?v=4","gravatar_id":"","url":"https://api.github.com/users/milotictanja","html_url":"https://github.com/milotictanja","followers_url":"https://api.github.com/users/milotictanja/followers","following_url":"https://api.github.com/users/milotictanja/following{/other_user}","gists_url":"https://api.github.com/users/milotictanja/gists{/gist_id}","starred_url":"https://api.github.com/users/milotictanja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milotictanja/subscriptions","organizations_url":"https://api.github.com/users/milotictanja/orgs","repos_url":"https://api.github.com/users/milotictanja/repos","events_url":"https://api.github.com/users/milotictanja/events{/privacy}","received_events_url":"https://api.github.com/users/milotictanja/received_events","type":"User","site_admin":false},{"login":"LienReyserhove","id":32466479,"avatar_url":"https://avatars0.githubusercontent.com/u/32466479?v=4","gravatar_id":"","url":"https://api.github.com/users/LienReyserhove","html_url":"https://github.com/LienReyserhove","followers_url":"https://api.github.com/users/LienReyserhove/followers","following_url":"https://api.github.com/users/LienReyserhove/following{/other_user}","gists_url":"https://api.github.com/users/LienReyserhove/gists{/gist_id}","starred_url":"https://api.github.com/users/LienReyserhove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LienReyserhove/subscriptions","organizations_url":"https://api.github.com/users/LienReyserhove/orgs","repos_url":"https://api.github.com/users/LienReyserhove/repos","events_url":"https://api.github.com/users/LienReyserhove/events{/privacy}","received_events_url":"https://api.github.com/users/LienReyserhove/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2/commits","review_comments_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2/comments","review_comment_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/2/comments","statuses_url":"https://api.github.com/repos/inbo/dwc-in-R/statuses/e193db4580c2fb9a37f24f3d91374e9b6fa9f654","head":{"label":"inbo:dplyr.Rmd","ref":"dplyr.Rmd","sha":"e193db4580c2fb9a37f24f3d91374e9b6fa9f654","user":{"login":"inbo","id":2735610,"avatar_url":"https://avatars1.githubusercontent.com/u/2735610?v=4","gravatar_id":"","url":"https://api.github.com/users/inbo","html_url":"https://github.com/inbo","followers_url":"https://api.github.com/users/inbo/followers","following_url":"https://api.github.com/users/inbo/following{/other_user}","gists_url":"https://api.github.com/users/inbo/gists{/gist_id}","starred_url":"https://api.github.com/users/inbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inbo/subscriptions","organizations_url":"https://api.github.com/users/inbo/orgs","repos_url":"https://api.github.com/users/inbo/repos","events_url":"https://api.github.com/users/inbo/events{/privacy}","received_events_url":"https://api.github.com/users/inbo/received_events","type":"Organization","site_admin":false},"repo":{"id":120744275,"name":"dwc-in-R","full_name":"inbo/dwc-in-R","owner":{"login":"inbo","id":2735610,"avatar_url":"https://avatars1.githubusercontent.com/u/2735610?v=4","gravatar_id":"","url":"https://api.github.com/users/inbo","html_url":"https://github.com/inbo","followers_url":"https://api.github.com/users/inbo/followers","following_url":"https://api.github.com/users/inbo/following{/other_user}","gists_url":"https://api.github.com/users/inbo/gists{/gist_id}","starred_url":"https://api.github.com/users/inbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inbo/subscriptions","organizations_url":"https://api.github.com/users/inbo/orgs","repos_url":"https://api.github.com/users/inbo/repos","events_url":"https://api.github.com/users/inbo/events{/privacy}","received_events_url":"https://api.github.com/users/inbo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inbo/dwc-in-R","description":"Standardizing data to Darwin Core using R","fork":false,"url":"https://api.github.com/repos/inbo/dwc-in-R","forks_url":"https://api.github.com/repos/inbo/dwc-in-R/forks","keys_url":"https://api.github.com/repos/inbo/dwc-in-R/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inbo/dwc-in-R/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inbo/dwc-in-R/teams","hooks_url":"https://api.github.com/repos/inbo/dwc-in-R/hooks","issue_events_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/events{/number}","events_url":"https://api.github.com/repos/inbo/dwc-in-R/events","assignees_url":"https://api.github.com/repos/inbo/dwc-in-R/assignees{/user}","branches_url":"https://api.github.com/repos/inbo/dwc-in-R/branches{/branch}","tags_url":"https://api.github.com/repos/inbo/dwc-in-R/tags","blobs_url":"https://api.github.com/repos/inbo/dwc-in-R/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inbo/dwc-in-R/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inbo/dwc-in-R/git/refs{/sha}","trees_url":"https://api.github.com/repos/inbo/dwc-in-R/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inbo/dwc-in-R/statuses/{sha}","languages_url":"https://api.github.com/repos/inbo/dwc-in-R/languages","stargazers_url":"https://api.github.com/repos/inbo/dwc-in-R/stargazers","contributors_url":"https://api.github.com/repos/inbo/dwc-in-R/contributors","subscribers_url":"https://api.github.com/repos/inbo/dwc-in-R/subscribers","subscription_url":"https://api.github.com/repos/inbo/dwc-in-R/subscription","commits_url":"https://api.github.com/repos/inbo/dwc-in-R/commits{/sha}","git_commits_url":"https://api.github.com/repos/inbo/dwc-in-R/git/commits{/sha}","comments_url":"https://api.github.com/repos/inbo/dwc-in-R/comments{/number}","issue_comment_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/comments{/number}","contents_url":"https://api.github.com/repos/inbo/dwc-in-R/contents/{+path}","compare_url":"https://api.github.com/repos/inbo/dwc-in-R/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inbo/dwc-in-R/merges","archive_url":"https://api.github.com/repos/inbo/dwc-in-R/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inbo/dwc-in-R/downloads","issues_url":"https://api.github.com/repos/inbo/dwc-in-R/issues{/number}","pulls_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls{/number}","milestones_url":"https://api.github.com/repos/inbo/dwc-in-R/milestones{/number}","notifications_url":"https://api.github.com/repos/inbo/dwc-in-R/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inbo/dwc-in-R/labels{/name}","releases_url":"https://api.github.com/repos/inbo/dwc-in-R/releases{/id}","deployments_url":"https://api.github.com/repos/inbo/dwc-in-R/deployments","created_at":"2018-02-08T10:05:55Z","updated_at":"2018-02-22T15:04:05Z","pushed_at":"2018-02-22T17:43:22Z","git_url":"git://github.com/inbo/dwc-in-R.git","ssh_url":"git@github.com:inbo/dwc-in-R.git","clone_url":"https://github.com/inbo/dwc-in-R.git","svn_url":"https://github.com/inbo/dwc-in-R","homepage":"https://inbo.github.io/dwc-in-R/","size":5063,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"inbo:master","ref":"master","sha":"e8f74b5e37d54905d81803c0fe4ca06b4ec8f64c","user":{"login":"inbo","id":2735610,"avatar_url":"https://avatars1.githubusercontent.com/u/2735610?v=4","gravatar_id":"","url":"https://api.github.com/users/inbo","html_url":"https://github.com/inbo","followers_url":"https://api.github.com/users/inbo/followers","following_url":"https://api.github.com/users/inbo/following{/other_user}","gists_url":"https://api.github.com/users/inbo/gists{/gist_id}","starred_url":"https://api.github.com/users/inbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inbo/subscriptions","organizations_url":"https://api.github.com/users/inbo/orgs","repos_url":"https://api.github.com/users/inbo/repos","events_url":"https://api.github.com/users/inbo/events{/privacy}","received_events_url":"https://api.github.com/users/inbo/received_events","type":"Organization","site_admin":false},"repo":{"id":120744275,"name":"dwc-in-R","full_name":"inbo/dwc-in-R","owner":{"login":"inbo","id":2735610,"avatar_url":"https://avatars1.githubusercontent.com/u/2735610?v=4","gravatar_id":"","url":"https://api.github.com/users/inbo","html_url":"https://github.com/inbo","followers_url":"https://api.github.com/users/inbo/followers","following_url":"https://api.github.com/users/inbo/following{/other_user}","gists_url":"https://api.github.com/users/inbo/gists{/gist_id}","starred_url":"https://api.github.com/users/inbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inbo/subscriptions","organizations_url":"https://api.github.com/users/inbo/orgs","repos_url":"https://api.github.com/users/inbo/repos","events_url":"https://api.github.com/users/inbo/events{/privacy}","received_events_url":"https://api.github.com/users/inbo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inbo/dwc-in-R","description":"Standardizing data to Darwin Core using R","fork":false,"url":"https://api.github.com/repos/inbo/dwc-in-R","forks_url":"https://api.github.com/repos/inbo/dwc-in-R/forks","keys_url":"https://api.github.com/repos/inbo/dwc-in-R/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inbo/dwc-in-R/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inbo/dwc-in-R/teams","hooks_url":"https://api.github.com/repos/inbo/dwc-in-R/hooks","issue_events_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/events{/number}","events_url":"https://api.github.com/repos/inbo/dwc-in-R/events","assignees_url":"https://api.github.com/repos/inbo/dwc-in-R/assignees{/user}","branches_url":"https://api.github.com/repos/inbo/dwc-in-R/branches{/branch}","tags_url":"https://api.github.com/repos/inbo/dwc-in-R/tags","blobs_url":"https://api.github.com/repos/inbo/dwc-in-R/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inbo/dwc-in-R/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inbo/dwc-in-R/git/refs{/sha}","trees_url":"https://api.github.com/repos/inbo/dwc-in-R/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inbo/dwc-in-R/statuses/{sha}","languages_url":"https://api.github.com/repos/inbo/dwc-in-R/languages","stargazers_url":"https://api.github.com/repos/inbo/dwc-in-R/stargazers","contributors_url":"https://api.github.com/repos/inbo/dwc-in-R/contributors","subscribers_url":"https://api.github.com/repos/inbo/dwc-in-R/subscribers","subscription_url":"https://api.github.com/repos/inbo/dwc-in-R/subscription","commits_url":"https://api.github.com/repos/inbo/dwc-in-R/commits{/sha}","git_commits_url":"https://api.github.com/repos/inbo/dwc-in-R/git/commits{/sha}","comments_url":"https://api.github.com/repos/inbo/dwc-in-R/comments{/number}","issue_comment_url":"https://api.github.com/repos/inbo/dwc-in-R/issues/comments{/number}","contents_url":"https://api.github.com/repos/inbo/dwc-in-R/contents/{+path}","compare_url":"https://api.github.com/repos/inbo/dwc-in-R/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inbo/dwc-in-R/merges","archive_url":"https://api.github.com/repos/inbo/dwc-in-R/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inbo/dwc-in-R/downloads","issues_url":"https://api.github.com/repos/inbo/dwc-in-R/issues{/number}","pulls_url":"https://api.github.com/repos/inbo/dwc-in-R/pulls{/number}","milestones_url":"https://api.github.com/repos/inbo/dwc-in-R/milestones{/number}","notifications_url":"https://api.github.com/repos/inbo/dwc-in-R/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inbo/dwc-in-R/labels{/name}","releases_url":"https://api.github.com/repos/inbo/dwc-in-R/releases{/id}","deployments_url":"https://api.github.com/repos/inbo/dwc-in-R/deployments","created_at":"2018-02-08T10:05:55Z","updated_at":"2018-02-22T15:04:05Z","pushed_at":"2018-02-22T17:43:22Z","git_url":"git://github.com/inbo/dwc-in-R.git","ssh_url":"git@github.com:inbo/dwc-in-R.git","clone_url":"https://github.com/inbo/dwc-in-R.git","svn_url":"https://github.com/inbo/dwc-in-R","homepage":"https://inbo.github.io/dwc-in-R/","size":5063,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2"},"html":{"href":"https://github.com/inbo/dwc-in-R/pull/2"},"issue":{"href":"https://api.github.com/repos/inbo/dwc-in-R/issues/2"},"comments":{"href":"https://api.github.com/repos/inbo/dwc-in-R/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inbo/dwc-in-R/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/inbo/dwc-in-R/statuses/e193db4580c2fb9a37f24f3d91374e9b6fa9f654"}},"author_association":"NONE"}}
{"actor":{"display_login":"damianooldoni"}}