R Code is Not Working in the RStudio IDE


If your R code is broken or produces errors while running in the RStudio IDE, try the following:

1. Run outside of RStudio

Test your R code by running it through the same version of R on a standard console session (RGui, R.app, Terminal, etc). RStudio attempts to process your code the same as these applications, however certain edge cases are always possible which result in unexpected behavior. If your code runs smoothly outside of RStudio and is broken inside RStudio, please open a new support discussion. Be sure to include the steps to reproduce this error (including necessary code) and we'll investigate.

2. Search for help

As an open source language, R is backed by a large community of users and resources for help. Our Getting Help with R Knowledge Base article points to some of the more well-known resources to help solve your R related problem.

You may also ask for help from R and RStudio users on community.rstudio.com. Be sure to include a reproducible example of your issue. To start a new community discussion, click here.

3. Problems with a certain R function or topic

R's built-in help utility provides detailed descriptions of R topics, functions, and their arguments. To show these help files, use the Help pane within RStudio. Alternatively, to access this help from the console for a particular R topic or function, for example subset, enter either of the following commands:

> help(subset)
> ?subset

Note that R will not be able to locate the help page for a function that comes with a package until you load the package that contains the function. You cna load a package with the library command.

Note: Code Completion will display inline help for functions when possible.

Return to Troubleshooting Guide: Using RStudio