Overview: Why R?
Whether you’re looking to start coding for a new career or just as a hobby, picking which programming language to start with can be a daunting task, especially if this is your very first experience with programming. There is no right answer for, it depends on the kind of project you’d work on, what is demanded on the job etc but here are some perks of R:
Objectives of this tutorial
- Learn to code in R following proper coding style guidelines
- Learn to automatically install R packages
- Familiarize yourself with a better way to manage your R packages
- Learn to conduct regression analysis using R for your next empirical project
- Learn to communicate your insights effectively using tools like interactive dashboards
- Discover how to publish e-books and interactive articles directly from R
Learn to code
As a first step, learn how to set up R and RStudio on your local machine. Next, we have compiled a comprehensive guide with links to useful sources to help you structure your coding learning journey for, it can be daunting to figure out the right resources among tons out there!
Furthermore, to polish your coding skills we have put together a succinct coding style guideline to follow.
More on R Packages
Packages are a set of R functions, data and compiled code bundled together and these are stored in a ‘library’. While R comes with a standard set of packages, one may install additional ones whenever required. As your project grows, the variety of packages used also broadens and it’s easy to lose track of them. Here’s a brief code snippet to automatically install packages that may not yet be installed on your machine.
In a similar vein, Packrat is an excellent tool to manage your R package library. It is the go-to solution to potential dependency issues between packages when working on multiple projects or when working on the same project using different machines which may have different versions of the packages installed. This helps make R packages isolated, portable and reproducible.
Check out our comprehensive guide to get you started with Packrat
Analysis with R: Examples
Got a hang of the R syntax and are looking to put your R coding skills to practice with some empirical project? Here are some starter guides and codes of commonly used techniques for descriptive and causal analysis.
Communicate your insights with R
One of the most important and challenging job of a researcher is communicating one’s findings to non-technical stakeholders in an appealing way. Fret not for, R facilitates creative ways to communicate your insights via interactive dashboards ( R Shiny) and also facilitates publishing content (e.g. e-books, slides, articles etc) on the web directly from R with tools like Distill, Bookdown and/or Quarto.
Wanna try them out for yourself? Here are some useful resources to help you get started.