{"action":"created","comment":{"url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/comments/77431102","id":77431102,"diff_hunk":"@@ -0,0 +1,39 @@\n+# Buggy Code 1\n+load(url(\"http://www.jakebowers.org/Data/meddat.rda\"))\n+colnames(meddat)\n+# This function works and it shows the names of the variables (columns) in the meddat data frame\n+\n+table(Group, useNA = \"ifany\")\n+# This function is suppossed to show the values for the \"Group\" variable, which has two possible outcomes (C-control group and T-treatment group). There are two errors with the code: (1) the name of the data frame was not included (meddat), and (2) the variable is named \"nhGroup\", not \"Group\". Here's the fixed code:\n+table(meddat$nhGroup, useNA = \"ifany\")\n+\n+mean(Pop2003)\n+# This function should give us the mean of the Population for the year 2003. However, the function does not work because the dataset was not included. Add the dataset (meddat) before the variable with a dollar symbol ($) and it runs.\n+mean(meddat$Pop2003)\n+\n+remove(meddat)\n+\n+# Buggy Code 2\n+load(url(\"http://www.jakebowers.org/Data/countries.rda\"))\n+\n+nonDemocraticCountries <- filter(smalldat, Cheibub4Type ?? \"Democracy\")\n+# This function aims to create a new data frame with the non-democratic countries listed in the Democracy-Dictatorship Index by attempting to exclude the \"democracies\" in the index. The first thing we need to fix in the code is the placements of the original data frame and the variable, and also the symbols (%>% and ==). The right order should be:\n+nonDemocraticCountries <- smalldat %>% filter(Cheibub4Type==\"Democracy\")\n+# But this code still wouldn't work. Why? Because you are suppossed to indicate the possibilities you want to include in your new data frame, not the ones you want to exclude. First of all, \"Democracy\" is not even a category in the D-D Idex. If we look at the Cheibub4Type variable using the summary function, we see that the set of possibilities consist of \"Dictatorship\", \"Parliamentary democracy\", \"Mixed executive\" and \"Presidential democracy\".\n+summary(smalldat$Cheibub4Type)\n+\n+# Out of these four possibilities, \"Dictatrship\" is the only to describe a non-democratic form of government. Thus, in order to create the non-democratic countries data frame, the appropriate code would be:\n+nonDemocraticCountries <- smalldat %>% filter(Cheibub4Type==\"Dictatorship\")\n+\n+democraticCountries <- filter(smalldat, Cheibub4Type %in% c(\"Democracy\"))\n+# This code aims to create a data frame with democratic countries, but when the spreadsheet is created, the rows are empty. The 19 variables are there, but the observations are not. How do we fix this? As we learned with the previous code, \"Democracy\" is not a possibility, \"Parliamentary democracy\", \"Mixed executive\" and \"Presidential democracy\" are. Since we now have three possibilities to include in our data frame, we can't use the same command as before (Cheibub4Type==\"\"). We need to use the combine values into a vector list function: c(). \n+help(\"c\")\n+# Then we also need to fix a bit the order and symbols (as in the previous case) for the filter function to work. The right code is:\n+democraticCountries <- smalldat %>% filter(Cheibub4Type %in% c(\"Parliamentary democracy\", \"Mixed executive\", \"Presidential democracy\"))","path":"Buggy Code fixed","position":32,"original_position":32,"commit_id":"2c5d36d1add8840feb90160b94fa2c4212741698","original_commit_id":"2c5d36d1add8840feb90160b94fa2c4212741698","user":{"login":"drenn2","id":4690897,"avatar_url":"https://avatars.githubusercontent.com/u/4690897?v=3","gravatar_id":"","url":"https://api.github.com/users/drenn2","html_url":"https://github.com/drenn2","followers_url":"https://api.github.com/users/drenn2/followers","following_url":"https://api.github.com/users/drenn2/following{/other_user}","gists_url":"https://api.github.com/users/drenn2/gists{/gist_id}","starred_url":"https://api.github.com/users/drenn2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drenn2/subscriptions","organizations_url":"https://api.github.com/users/drenn2/orgs","repos_url":"https://api.github.com/users/drenn2/repos","events_url":"https://api.github.com/users/drenn2/events{/privacy}","received_events_url":"https://api.github.com/users/drenn2/received_events","type":"User","site_admin":false},"body":"There is an alternative way to do this using \"!=\" like this:\r\n\r\nfilter(Cheibub4Type !%in% c(\"Dictatorship\") \r\n\r\nor simply\r\n\r\nfilter(Cheibub4Type != \"Dictatorship\") ","created_at":"2016-09-03T04:19:28Z","updated_at":"2016-09-03T04:19:28Z","html_url":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2#discussion_r77431102","pull_request_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/comments/77431102"},"html":{"href":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2#discussion_r77431102"},"pull_request":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2","id":83553663,"html_url":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2","diff_url":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2.diff","patch_url":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2.patch","issue_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/2","number":2,"state":"open","locked":false,"title":"Create Buggy Code fixed","user":{"login":"rjagosto","id":21207320,"avatar_url":"https://avatars.githubusercontent.com/u/21207320?v=3","gravatar_id":"","url":"https://api.github.com/users/rjagosto","html_url":"https://github.com/rjagosto","followers_url":"https://api.github.com/users/rjagosto/followers","following_url":"https://api.github.com/users/rjagosto/following{/other_user}","gists_url":"https://api.github.com/users/rjagosto/gists{/gist_id}","starred_url":"https://api.github.com/users/rjagosto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjagosto/subscriptions","organizations_url":"https://api.github.com/users/rjagosto/orgs","repos_url":"https://api.github.com/users/rjagosto/repos","events_url":"https://api.github.com/users/rjagosto/events{/privacy}","received_events_url":"https://api.github.com/users/rjagosto/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-01T00:46:23Z","updated_at":"2016-09-03T04:19:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"013a8d4aee80dd6b9e43ab6eb7c68c76a66af817","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2/commits","review_comments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2/comments","review_comment_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/2/comments","statuses_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/statuses/2c5d36d1add8840feb90160b94fa2c4212741698","head":{"label":"bowers-grad-stats-illinois:rjagosto-patch-1","ref":"rjagosto-patch-1","sha":"2c5d36d1add8840feb90160b94fa2c4212741698","user":{"login":"bowers-grad-stats-illinois","id":21211161,"avatar_url":"https://avatars.githubusercontent.com/u/21211161?v=3","gravatar_id":"","url":"https://api.github.com/users/bowers-grad-stats-illinois","html_url":"https://github.com/bowers-grad-stats-illinois","followers_url":"https://api.github.com/users/bowers-grad-stats-illinois/followers","following_url":"https://api.github.com/users/bowers-grad-stats-illinois/following{/other_user}","gists_url":"https://api.github.com/users/bowers-grad-stats-illinois/gists{/gist_id}","starred_url":"https://api.github.com/users/bowers-grad-stats-illinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bowers-grad-stats-illinois/subscriptions","organizations_url":"https://api.github.com/users/bowers-grad-stats-illinois/orgs","repos_url":"https://api.github.com/users/bowers-grad-stats-illinois/repos","events_url":"https://api.github.com/users/bowers-grad-stats-illinois/events{/privacy}","received_events_url":"https://api.github.com/users/bowers-grad-stats-illinois/received_events","type":"Organization","site_admin":false},"repo":{"id":66655203,"name":"dailyR","full_name":"bowers-grad-stats-illinois/dailyR","owner":{"login":"bowers-grad-stats-illinois","id":21211161,"avatar_url":"https://avatars.githubusercontent.com/u/21211161?v=3","gravatar_id":"","url":"https://api.github.com/users/bowers-grad-stats-illinois","html_url":"https://github.com/bowers-grad-stats-illinois","followers_url":"https://api.github.com/users/bowers-grad-stats-illinois/followers","following_url":"https://api.github.com/users/bowers-grad-stats-illinois/following{/other_user}","gists_url":"https://api.github.com/users/bowers-grad-stats-illinois/gists{/gist_id}","starred_url":"https://api.github.com/users/bowers-grad-stats-illinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bowers-grad-stats-illinois/subscriptions","organizations_url":"https://api.github.com/users/bowers-grad-stats-illinois/orgs","repos_url":"https://api.github.com/users/bowers-grad-stats-illinois/repos","events_url":"https://api.github.com/users/bowers-grad-stats-illinois/events{/privacy}","received_events_url":"https://api.github.com/users/bowers-grad-stats-illinois/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bowers-grad-stats-illinois/dailyR","description":"5-7 times a week","fork":false,"url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR","forks_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/forks","keys_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/teams","hooks_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/hooks","issue_events_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/events{/number}","events_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/events","assignees_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/assignees{/user}","branches_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/branches{/branch}","tags_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/tags","blobs_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/refs{/sha}","trees_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/statuses/{sha}","languages_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/languages","stargazers_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/stargazers","contributors_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/contributors","subscribers_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/subscribers","subscription_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/subscription","commits_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/commits{/sha}","git_commits_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/commits{/sha}","comments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/comments{/number}","issue_comment_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/comments{/number}","contents_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/contents/{+path}","compare_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/merges","archive_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/downloads","issues_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues{/number}","pulls_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls{/number}","milestones_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/milestones{/number}","notifications_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/labels{/name}","releases_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/releases{/id}","deployments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/deployments","created_at":"2016-08-26T14:43:44Z","updated_at":"2016-08-31T20:06:11Z","pushed_at":"2016-09-01T00:46:23Z","git_url":"git://github.com/bowers-grad-stats-illinois/dailyR.git","ssh_url":"git@github.com:bowers-grad-stats-illinois/dailyR.git","clone_url":"https://github.com/bowers-grad-stats-illinois/dailyR.git","svn_url":"https://github.com/bowers-grad-stats-illinois/dailyR","homepage":null,"size":8,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"bowers-grad-stats-illinois:master","ref":"master","sha":"2049b09ecc4b9c3ba370a87ac3b0a25e2baa4bee","user":{"login":"bowers-grad-stats-illinois","id":21211161,"avatar_url":"https://avatars.githubusercontent.com/u/21211161?v=3","gravatar_id":"","url":"https://api.github.com/users/bowers-grad-stats-illinois","html_url":"https://github.com/bowers-grad-stats-illinois","followers_url":"https://api.github.com/users/bowers-grad-stats-illinois/followers","following_url":"https://api.github.com/users/bowers-grad-stats-illinois/following{/other_user}","gists_url":"https://api.github.com/users/bowers-grad-stats-illinois/gists{/gist_id}","starred_url":"https://api.github.com/users/bowers-grad-stats-illinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bowers-grad-stats-illinois/subscriptions","organizations_url":"https://api.github.com/users/bowers-grad-stats-illinois/orgs","repos_url":"https://api.github.com/users/bowers-grad-stats-illinois/repos","events_url":"https://api.github.com/users/bowers-grad-stats-illinois/events{/privacy}","received_events_url":"https://api.github.com/users/bowers-grad-stats-illinois/received_events","type":"Organization","site_admin":false},"repo":{"id":66655203,"name":"dailyR","full_name":"bowers-grad-stats-illinois/dailyR","owner":{"login":"bowers-grad-stats-illinois","id":21211161,"avatar_url":"https://avatars.githubusercontent.com/u/21211161?v=3","gravatar_id":"","url":"https://api.github.com/users/bowers-grad-stats-illinois","html_url":"https://github.com/bowers-grad-stats-illinois","followers_url":"https://api.github.com/users/bowers-grad-stats-illinois/followers","following_url":"https://api.github.com/users/bowers-grad-stats-illinois/following{/other_user}","gists_url":"https://api.github.com/users/bowers-grad-stats-illinois/gists{/gist_id}","starred_url":"https://api.github.com/users/bowers-grad-stats-illinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bowers-grad-stats-illinois/subscriptions","organizations_url":"https://api.github.com/users/bowers-grad-stats-illinois/orgs","repos_url":"https://api.github.com/users/bowers-grad-stats-illinois/repos","events_url":"https://api.github.com/users/bowers-grad-stats-illinois/events{/privacy}","received_events_url":"https://api.github.com/users/bowers-grad-stats-illinois/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bowers-grad-stats-illinois/dailyR","description":"5-7 times a week","fork":false,"url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR","forks_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/forks","keys_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/teams","hooks_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/hooks","issue_events_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/events{/number}","events_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/events","assignees_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/assignees{/user}","branches_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/branches{/branch}","tags_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/tags","blobs_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/refs{/sha}","trees_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/statuses/{sha}","languages_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/languages","stargazers_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/stargazers","contributors_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/contributors","subscribers_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/subscribers","subscription_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/subscription","commits_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/commits{/sha}","git_commits_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/git/commits{/sha}","comments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/comments{/number}","issue_comment_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/comments{/number}","contents_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/contents/{+path}","compare_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/merges","archive_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/downloads","issues_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues{/number}","pulls_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls{/number}","milestones_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/milestones{/number}","notifications_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/labels{/name}","releases_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/releases{/id}","deployments_url":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/deployments","created_at":"2016-08-26T14:43:44Z","updated_at":"2016-08-31T20:06:11Z","pushed_at":"2016-09-01T00:46:23Z","git_url":"git://github.com/bowers-grad-stats-illinois/dailyR.git","ssh_url":"git@github.com:bowers-grad-stats-illinois/dailyR.git","clone_url":"https://github.com/bowers-grad-stats-illinois/dailyR.git","svn_url":"https://github.com/bowers-grad-stats-illinois/dailyR","homepage":null,"size":8,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2"},"html":{"href":"https://github.com/bowers-grad-stats-illinois/dailyR/pull/2"},"issue":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/2"},"comments":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/bowers-grad-stats-illinois/dailyR/statuses/2c5d36d1add8840feb90160b94fa2c4212741698"}}}}
{"actor":{"display_login":"drenn2"}}