Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Safely access RStudio's API (when available)

Subscribe to updates I use rstudioapi

Statistics on rstudioapi

Number of watchers on Github 42
Number of open issues 31
Average time to close an issue 4 days
Main language R
Average time to merge a PR 5 days
Open pull requests 4+
Closed pull requests 3+
Last commit almost 2 years ago
Repo Created almost 6 years ago
Repo Last Updated almost 2 years ago
Size 253 KB
Organization / Authorrstudio
Page Updated
Do you use rstudioapi? Leave a review!
View open issues (31)
View rstudioapi activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating rstudioapi for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Travis-CI Build Status

The rstudioapi package is designed to make it easy to conditionally access the RStudio API from CRAN packages, avoiding any potential problems with R CMD check. This package contains a handful of useful wrapper functions to access the API. To see the functions that are currently available in the API, run help(package = "rstudioapi")

Example uses

# rstudioapi is designed to never be attached to your search path.
# Always prefix function calls with rstudioapi::

# Returns T/F
# Returns error if not available

# Optional argument allows you to specify version requirement

# Call an rstudio function
rstudioapi::callFun("viewer", "http://localhost:8080")

# This will raise an error if rstudio is not running, or the function
# is not found. To run a different function if it's not available,
# use exists
if (rstudioapi::hasFun("viewer")) {
  rstudioapi::callFun("viewer", "http://localhost:8080")
} else {

# You can use find to get the function. Throws an error if the function
# does not exist.

# You can also check version in exists and find
rstudioapi::findFun("viewer", 0.99)
rstudioapi::hasFun("viewer", 0.99)


  • Install the development version with devtools::install_github("rstudio/rstudioapi").
rstudioapi open issues Ask a question     (View All Issues)
  • about 3 years Encoding problem with `rstudioapi::getActiveDocumentContext()`
  • about 3 years Access file and directory selection dialogs
  • about 3 years add 'restartR' function
  • over 3 years Encoding issue: `getActiveDocumentContext()` does not read international symbols correctly
  • over 3 years rstudioapi::getActiveProject() in a shiny gadget
  • over 3 years Progress bar
  • over 3 years Blank Password
  • almost 4 years (Re-)launch a Project?
  • almost 4 years Launch an external process in the build window
  • almost 4 years Close an open document
  • almost 4 years Save all open documents
  • almost 4 years detect (within Addin) when user focus is on console
  • almost 4 years provide helpers to interactive with the document selection
  • about 4 years rstudioapi::hasFun("debugSource") returns FALSE
  • over 4 years Embeded iframe in rstudio viewer
rstudioapi open pull requests (View All Pulls)
  • Terminal APIs (work-in-progress)
  • Change default showPrompt field value to empty string
  • Add support for askForSecret api
  • Fix getActiveProject() for non-ASCII file paths
rstudioapi list of languages used
Other projects in R