The R Language is a free computer programming language developed for data analysis.
A number of different apps have been developed for conducting analyses written in the R Language. Somewhat confusingly, the most widely used program for conducting analyses using the R language is also called R (or the R Console). Q has special servers with R installed and any R code used by Q is processed there, more info is on our sister software Displayr's wiki here.
Method - External Resources
Because R is an open-sourced (free) language, there are tons of information about it on the web. There are technical pages on the different functions, websites offering courses, forums where you can ask and search for questions, and blogs with worked examples. Whichever format is best for you will depend upon your technical skills, background, and what you are trying to achieve.
Some methods to call out that we've found useful include:
- Online courses: DataCamp and Bootcamp are two sites to look into.
- Books: There are many different books on R and the trick is usually to find a book written by somebody whose background matches your own. The Art of Programming in R is a staff favorite.
- Webpages and blogs: R-bloggers is great and Cross Validated has a long list of free websites.
- RStudio has created a lot of "cheatsheets" (in addition to other educational resources) that outline some useful functions in R. You can start with the Base R cheatsheet here.
When troubleshooting R, simply putting in the error message or a description of the issue in Google and adding "in R" at the end should be your first stop. This will search over the many forums that are out there where users ask similar questions. One of the most widely used forums, if you want to search directly, is StackOverflow.
Method - Q Resources
- There are a plethora of examples of R coding in our Q Help Center if you search for "How to X Using R".
- Our Using R in Displayr Video Series gives you an intro into how to use R in Displayr and walks through many examples of R coding in Displayr. Though not all examples may be relevant to Q since some reference interactive dashboarding controls, the same code and examples can be executed in Q. You can also download a copy of the code in a QPack the quickly access examples.
- The following articles are a good intro for getting the basics down of how to code in R in Q:
- Some of our most useful R examples are below:
- How to Extract Information from an R Object
- How to Extract Data from a Multiple Column Table with Nested Data
- How to Use R Code to Create a Filter Based on Single-Response Questions
- How to Create a New Variable Based on Other Variables using R
- How to Perform Mathematical Calculations Using R
- How to Hide Rows or Columns Based on Sample Size Using R
- How to Merge Tables Using R
- How to Aggregate Data Using R
- How to Standardize or Calculate Data within Subgroups in R
- How To Apply Different Weighting Structures To Sub-Samples
While we don't offer formal R training at Q, we can try to help point you in the right direction or get you unstuck if you email email@example.com.
Other tips to keep in mind
- Please use # to comment your code. This will help you remember what the intent of the code is when you review it later. It will also help our Support Team, if you email us asking for help.
- R is case-sensitive.
- Sometimes there are many ways to do the same thing and there's not necessarily a "right answer"