Aside: goals for this thread
I'm hoping this will help people disambiguate R from RStudio, and also help with getting questions in the right category. This is a bit of a mashup of the times I've tried to explain this in individual threads, so please feel free to add to this topic for further clarification/point out corrections, etc.
Before putting a code-related question in the RStudio IDE category or using the rstudio
tag, it's helpful to ask yourself:
Does this work in the regular R GUI, but not when you're in RStudio?
If you're using RStudio, you're using R — RStudio is just an IDE (Integrated Development Environment) in which you are using the R language. (On of my favourite figures from Modern Dive, below, illustrates the difference nicely).
If you're having a problem running code and think it might be IDE-related, it's a good idea do try it out in vanilla R (which has its own GUI as well that will be on your computer) — the logos, below, might help as a visual reference for you.
For further disambiguation/a good explanation of the relationship between R and RStudio, check out this chapter of Modern Dive:
http://moderndive.com/2-getting-started.html