Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rstudio_type

Type a character vector into the RStudio source editor


Description

Use the rstudioapi package to insert characters one by one into the RStudio source editor, as if they were typed by a human.

Usage

rstudio_type(x, pause = function() 0.1, mistake = 0, save = 0)

Arguments

x

A character vector.

pause

A function to return a number in seconds to pause after typing each character.

mistake

The probability of making random mistakes when typing the next character. A random mistake is a random string typed into the editor and deleted immediately.

save

The probability of saving the document after typing each character. Note that If a document is not opened from a file, it will never be saved.

Examples

library(xfun)
if (loadable("rstudioapi") && rstudioapi::isAvailable()) {
    rstudio_type("Hello, RStudio! xfun::rstudio_type() looks pretty cool!", 
        pause = function() runif(1, 0, 0.5), mistake = 0.1)
}

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.