Practice makes perfection. Use what you learned here as much as possible in your own research and work, even though you may not master everything first off. Once you find a solution to your data science problem, think whether it conforms the [Best practices for data science]; If not, can you improve your solution according to the best practices?
R is getting more powerful all the time. There are many exciting features and packages that we have not covered and many more are emerging. Below are a few features I think are worth mentioning.
It is probably the easiest to share your R code with others by creating a R package for it. It is not as intimidating as it sounds. Fong Chun Chan wrote a tutorial for creating your first R package. For a more comprehensive resource, check out Hadley Wickham’s R Packages.
It is always a good idea to test your code with simple inputs to make sure it work correctly before adding complexity and deploying it for actual work (see best practices for data science 5). There are ways to automate the tests, so you will not forget to run the tests. Hadley Wickham writes about testing for R packages and testthat
is a R package specifically to make testing. And if you use GitHub or other popular public version control website, it is possible to use Travis-CI to do “continuous integration” tests for your code. Julia Silge has a nice tutorial for beginners.
If you are seasoned programmer and are familiar with the make
toolchain, you can use it to automate your workflow too. Professor Jenny Bryan provides a tutorial for her STAT 545 class.
A more research-oriented solution is to use the remake
package:
The idea here is to re-imagine a set of ideas from make but built for R. Rather than having a series of calls to different instances of R (as happens if you run make on R scripts), the idea is to define pieces of a pipeline within an R session. Rather than being language agnostic (like make must be), remake is unapologetically R focused.
remake
is still under heavy development and is not yet available on CRAN. You will have to install it from github:
library(devtools)
install_github("richfitz/remake")
Shiny allows you to develop interactive apps that run on top of R. Again Prof Jenny Bryan has a nice tutorial for getting started with Shiny.