{"action":"created","issue":{"url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/89","repository_url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder","labels_url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/89/comments","events_url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/89/events","html_url":"https://github.com/swcarpentry/r-novice-gapminder/pull/89","id":131801824,"number":89,"title":"reimagining data types and data structures","user":{"login":"BillMills","id":1896943,"avatar_url":"https://avatars.githubusercontent.com/u/1896943?v=3","gravatar_id":"","url":"https://api.github.com/users/BillMills","html_url":"https://github.com/BillMills","followers_url":"https://api.github.com/users/BillMills/followers","following_url":"https://api.github.com/users/BillMills/following{/other_user}","gists_url":"https://api.github.com/users/BillMills/gists{/gist_id}","starred_url":"https://api.github.com/users/BillMills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BillMills/subscriptions","organizations_url":"https://api.github.com/users/BillMills/orgs","repos_url":"https://api.github.com/users/BillMills/repos","events_url":"https://api.github.com/users/BillMills/events{/privacy}","received_events_url":"https://api.github.com/users/BillMills/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-02-06T01:12:07Z","updated_at":"2016-02-22T19:19:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/pulls/89","html_url":"https://github.com/swcarpentry/r-novice-gapminder/pull/89","diff_url":"https://github.com/swcarpentry/r-novice-gapminder/pull/89.diff","patch_url":"https://github.com/swcarpentry/r-novice-gapminder/pull/89.patch"},"body":"Hi folks - this PR remixes sections 4 and 5 (intro to data types and data structures), following the pattern tested out by @lmguzman [at UBC](http://lmguzman.github.io/2016-01-29-UBC/index.html) and myself  [at ResBaz SFU](http://bgran.de/2016-02-02-SFU/) over the past week; the core motivation is to **introduce types and structures by exploring the data.frame**.\r\n\r\nUnderstanding types and structures is crucial for successfully wielding R - the problem being, that beginners really struggle to see why this is so, and are often turned off by how dry the topic seems. Instead of marching them through a gallery of types and structures, this method starts by loading a csv right away, and performing common manipulations which quickly lead to illustrations and conversations on why data types exist, what the properties of data structures are, and how they inform best practice for looking at and understanding data. Feedback was positive from students on both runs at this version.\r\n\r\n@aammd @theavanrossum @cloucks have all seen this taught live - did I miss anything / anything we should change in hindsight? If someone better at knittr than I would jam this through that framework to doublecheck it too, I'd be much obliged. Feedback welcome, let me know.\r\n "},"comment":{"url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/comments/187328696","html_url":"https://github.com/swcarpentry/r-novice-gapminder/pull/89#issuecomment-187328696","issue_url":"https://api.github.com/repos/swcarpentry/r-novice-gapminder/issues/89","id":187328696,"user":{"login":"ateucher","id":2816635,"avatar_url":"https://avatars.githubusercontent.com/u/2816635?v=3","gravatar_id":"","url":"https://api.github.com/users/ateucher","html_url":"https://github.com/ateucher","followers_url":"https://api.github.com/users/ateucher/followers","following_url":"https://api.github.com/users/ateucher/following{/other_user}","gists_url":"https://api.github.com/users/ateucher/gists{/gist_id}","starred_url":"https://api.github.com/users/ateucher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ateucher/subscriptions","organizations_url":"https://api.github.com/users/ateucher/orgs","repos_url":"https://api.github.com/users/ateucher/repos","events_url":"https://api.github.com/users/ateucher/events{/privacy}","received_events_url":"https://api.github.com/users/ateucher/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T19:19:11Z","updated_at":"2016-02-22T19:19:11Z","body":"Hi all, sorry for taking so long to get back to you with my comments.\r\n\r\nFirst of all, I REALLY like this lesson. The flow is great, and it introduces concepts in a context in which students can see the applicability immediately (I actually got this feedback directly from a couple of students).\r\n\r\nI agree with most of @aammd 's comments, and I'll summarize how I addressed them, as well as a few other modifications I made (which I realize are not necessarily about this PR).\r\n\r\n1. I introduced functions (using, not creating) in the introduction lesson, so this isn't their first encounter with them. I talked about what a function is, how to call it, what is an argument, default argument values, what is a return value, etc. in that earlier lesson.\r\n\r\n2. I removed all square-bracket subsetting from my version of this lesson, and really focused on using this to introduce data types and structures. I actually did subsetting immediately AFTER plotting, which worked pretty well, because during the plotting section I had questions like 'What if I want to plot just the African countries?'.\r\n\r\n3. I agree 100% with @aammd 's comments about `rbind` and `cbind`. I removed all references to both, and replaced the `cbind` with creating a new column like Andrew's suggestion (though I think those weights must be in kg already - if they're in lbs, they must be really small cats!).\r\n\r\n4. **Creating the \"cats\" csv:** In my organization, Excel is a religion, so I didn't really need to worry about people having different software. I got participants to create the cats data in Excel to illustrate *how to save an Excel file as a csv*. I then had them open the file in a text editor to show them exactly what a csv is - just a text file with columns delimted by commas. I explained that while R can read Excel files directly, it much prefers delimited text and you are less likely to run into problems if you do it this way.  \r\n\r\n5. I replaced `read.table()` with `read.csv()` since csvs are what they will encounter most of the time. I mentioned that tab-delimited files are also very common, and that `read.delim()` deals well with those, and that if they have a file delimited by something other than commas or tabs, then `read.table()` is available, and more flexible.\r\n\r\n6. When talking about data types, I also talked about using `class()` to find out what an object is - this resonated especially well when explaining that factors are integers under the hood - `class(myFactor)` returns `\"factor\"`, while `typeof(myFactor)` returns `\"integer\"`. Also, when you use `str()` on a data.frame, it is the class of each column that is displayed, not the atomic type.  I know when I was learning R the distinction between atomic types and classes really confused me for a while.\r\n\r\n7. In the initial creation of the \"cats \" csv, I had them encode `likes_string` as `0` or `1` rather than `TRUE` or `FALSE`. Then I used `as.logical(cats$likes_string)` to illustrate type coercion in a context that they are likely to come across at some point.\r\n"}}