These are notebooks that describe tasks that I use when working with data for journalism in R but don't do often enough to remember off the top of my head.
These are mostly recipes for things that took me a bit of time to Google or for which I didn't know the right language.
Use str
:
str(mydata)
Source: Quick-R: Viewing Data
- Group by part of a date variable
- Conditional aggregates on groups. This is sort of like a "count if".
- Convert coordinates in a CSV to spatial data
I do most of my work with R using RStudio. These are some helpful tips I've learned about working in that environment.
You can change the keyboard shortcuts in RStudio to mimic that of the vim editor (and a few other editors).
Source: Customizing RStudio.
- How Do I? …: Sharon Machlis has made a searchable table of tasks in R to accompany her book Practical R for Mass Communication and Journalism.
- RStudio Cheat Sheets: RStudio has a number of PDF cheatsheets about a wide range of topics and libraries including visualization using ggplot2 and data transformation using dplyr.