Safely Access the RStudio API

Access the RStudio API (if available) and provide informative error messages when it's not.


rstudioapi 0.10

  • Added the parameters echo and focus to sendToConsole().

rstudioapi 0.9

  • Added functions for displaying jobs in RStudio's Jobs pane: jobAdd(), jobRemove(), etc.

  • Added translateLocalUrl(), for translating localhost URLs to externally addressable ones on RStudio Server.

rstudioapi 0.8

  • Added functions for installing + using build tools: buildToolsCheck(), buildToolsInstall(), buildToolsExec()

  • Added functions for installing + using themes: addTheme(), applyTheme(), convertTheme(), getThemes(), getThemeInfo().

  • Added previewSql(), for previewing output from executing a SQL query.

  • Added askForSecret(), for prompting the user to enter a password or otherwise privileged information.

  • Fixed an issue where getActiveProject() failed for non-ASCII paths. (#86)

rstudioapi 0.7

  • Added methods for prompting the user for file paths: selectFile(), selectDirectory().

  • askForPassword() gains a default prompt (#41)

  • Add createProjectTemplate() function

  • Add setPersistentValue() / getPersistentValue() functions

  • Add methods for interacting with Terminal tab: terminalActivate(), terminalClear(), terminalCreate(), terminalList(), terminalBuffer(), terminalContext(), terminalVisible(), terminalBusy(), terminalRunning(), terminalKill(), terminalSend(), terminalExecute(), and terminalExitCode().

rstudioapi 0.6

  • Add sendToConsole function

  • Add APIs for setting cursor position in document

rstudioapi 0.5

  • Add askForPassword function

  • Add getActiveProject function

rstudioapi 0.4

  • Add API methods for interacting with a document open in RStudio: 'insertText()', 'modifyRange()' and 'getActiveDocumentContext()'.

rstudioapi 0.3

  • Add stub and documentation for sourceMarker function

rstudioapi 0.2

  • Compatibility with calling conventions for RStudio v0.99

  • Stubs and documentation for versionInfo, previewRd, and viewer functions

rstudioapi 0.1

Initial release to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.13 by Kevin Ushey, a year ago

Report a bug at

Browse source code at

Authors: Kevin Ushey [aut, cre] , JJ Allaire [aut] , Hadley Wickham [aut] , Gary Ritchie [aut] , RStudio [cph]

Documentation:   PDF Manual  

MIT + file LICENSE license

Suggests testthat, knitr, rmarkdown, clipr

Imported by BARIS, BED, BETS, DataEditR, DescTools, DescToolsAddIns, DiagrammeR, EventStudy, GUIProfiler, JSconsole, MarginalMediation, MetaAnalyser, NACHO, NMproject, PAMpal, PSPManalysis, ReDaMoR, RepoGenerator, SDMtune, SIPDIBGE, SPARTAAS, SemNetCleaner, ShinyItemAnalysis, SpaDES.addins, TeXCheckR, Tmisc, abjutils, aceEditor, addinsJoaoMelo, addinsOutline, aif360, anomalize, argonR, asciiSetupReader, azuremlsdk, baRcodeR, bayesmodels, boomer, buildr, cabinets, causact, censo2017, cheatsheet, cloudml, comFuncs, conflr, convertr, correlationfunnel, crunchy, cwbtools, datacleanr, datapasta, debugr, devtools, dipsaus, distill, diveR, do, document, dplyrAssist, dsims, echarts4r, editData, emuR, erify, esquisse, evaluator, exampletestr, featuretoolsR, fgeo, fitbitViz, fitur, flow, fpp2, fpp3, framecleaner, fresh, galigor, gargle, gert, getPass, ggThemeAssist, ggedit, ggplotAssist, gimmeTools, giphyr, gitgadget, gm, golem, goodpractice, healthyverse, htmlTable, iSTATS, iheiddown, job, jsTreeR, jsmodule, kableExtra, kerastuneR, kntnr, liftr, linguisticsdown, lintr, mailmerge, mappoly, matahari, mathpix, monaco, mstrio, multilinguer, multiverse, namer, neo4r, nlrx, nzilbb.labbcat, origin, packagefinder, packer, paletteer, personalr, pipefittr, pkgload, postcards, precommit, prettifyAddins, projects, pylintR, qiitr, quarto, questionr, r2d3, r2dictionary, r6methods, rTorch,, radix, rcompendium, remedy, repana, reportfactory, reprex, rgrassdoc, ropenblas, rsconnect, rskey, rstudio.prefs, seecolor, shiny.i18n, shinyobjects, shinyrecipes, shinytest, simhelpers, simrel, sinew, sketch, snahelper, spAddins, sparklyr, stepp, svDialogs, tensorflow, texPreview, tfaddons, tfhub, tfruns, thematic, tidymodels, tidyquant, tidytuesdayR, tidyverse, todor, togglr, tradepolicy, tribe, twenty48, usethis, varsExplore, vtable, whereami, workflowr, xpectr, ymlthis, ztable.

Depended on by RAC, docknitr, shortcuts.

Suggested by AMR, EGAnet, Luminescence, RPyGeo, Rdpack, ReviewR, SpaDES.core, ariExtra, backpipe, behaviorchange, blogdown, bookdown, bruceR, civis, cli, cliapp, clipr, cloudstoR, codebook, colourpicker, colt, covr, crayon, crunch, datadogr, dataquieR, disk.frame, docstring, drake, easyr, ecmwfr, fastshap, flair, ggExtra, googleAuthR, googleCloudRunner, gtools, hablar, healthyR,, healthyR.ts, hutils, insight, ipumsr, knitrdata, listviewer, mapview, natmanager, neatStats, neonstore, netrankr, objectremover, paws.common, pkgdepends, pkgdown, pkgsearch, plumber, prettycode, progressr, prompt, rbin, rco, renv, rextendr, rgee, rhandsontable, rock, roxygen2md, rscala, rstan, rstantools, rstoat, servr, shinyMobile, stanette, styler, sudachir, summarytools, tabxplor, targets, testit, testthat, testthis, tinsel, tinytex, trackr, ubiquity, ufs, vroom, wacolors, xaringan, xfun, ypr.

Enhanced by box.

See at CRAN