My friend is a dedicated R user but hasn’t had exposure to the awesomeness of RStudio and their many contributions to the scientific community. Since she is a new professor starting up her lab, we are starting a series of Skype calls and screen sharing to get her comfortable (and converted!). For our first call, I tried to categorize the awesomeness that would be most accessible for her needs: Intro to the IDE, R Packages, and Support.
If R were an airplane, RStudio would be the airport, providing many, many supporting services that make it easier for you, the pilot, to take off and go to awesome places. Sure, you can fly an airplane without an airport, but having those runways and supporting infrastructure is a game-changer. This is why.
Here are the main features to look at as we walk through the IDE together. (IDE stands for integrated development environment.) Check out the webinar and RStudio IDE cheatsheet for more.
.rproj
: load working directory; have multiple sessionsAnd check out the blog for the most recent RStudio v0.99.878 release
RStudio has made a bunch of packages that are complete game-changers for data wrangling and analysis. Chains (%>%
) make your code more readable, with fewer temporary variables, which enables humans like your future self and your collaborators to tell what is going on, and cleaner code helps reduce mistakes.
dplyr
. This changes everything. Use dplyr verbs and chains (%>%
) to make code readable to you and others. A few great blogs from RStudio: ‘Introducing dplyr’ and statsblogs: ‘How dplyr replaced some of my most common idioms’. Also, check out the data wrangling cheatsheet. Main verbs (guess what they do!):
filter()
arrange()
select()
mutate()
summarise()
tidyr
. Get your messy data into a format you can work with, quickly! Great blogs from RStudio: ‘Introducing tidyr’ and I’m a Chordata: ‘You complete me’, and the data wrangling cheatsheet. Main verbs:
gather()
spread()
complete()
ggplot2
. The grammar of graphics: build plots more intuitively, and with chains. More info at ggplot2.org, and the ggplot2 cheatsheet.
knitr
, rmarkdown
make documents in markdown with executable R code, eg: rendered .html, rendered .pdf, and rendered presentations!
readr
, readxl
. Read files in faster, with fewer arguments
stringr
. Easier string wrangling!
lubridate
. Easier date wrangling!
so many more…
Another total game-changer:
shiny
. Interactive web applications, all from R. Is so useful for science communication and data exploration, and the possibilities are really endless. Learn all about it shiny.rstudio.com and see examples: gallery.RStudio really prioritizes communication and so resources available online are incredible. Google your questions or error messages, and you’ll find the RStudio team’s instruction, tutorials, bug fixes, etc. Along with stackoverflow.com, keep an eye out for GitHub issues from RStudio: github.com/rstudio and individuals at RStudio (read on…).
The greater RStudio and #rstats community is making some incredible resources for teaching all of this stuff.