| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/rstudio.R |
| 3 |
\name{rstudio_type} |
| 4 |
\alias{rstudio_type} |
| 5 |
\title{Type a character vector into the RStudio source editor} |
| 6 |
\usage{ |
| 7 |
rstudio_type(x, pause = function() 0.1, mistake = 0, save = 0) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A character vector.} |
| 11 |
|
| 12 |
\item{pause}{A function to return a number in seconds to pause after typing |
| 13 |
each character.} |
| 14 |
|
| 15 |
\item{mistake}{The probability of making random mistakes when typing the next |
| 16 |
character. A random mistake is a random string typed into the editor and |
| 17 |
deleted immediately.} |
| 18 |
|
| 19 |
\item{save}{The probability of saving the document after typing each |
| 20 |
character. Note that If a document is not opened from a file, it will never |
| 21 |
be saved.} |
| 22 |
} |
| 23 |
\description{ |
| 24 |
Use the \pkg{rstudioapi} package to insert characters one by one into the |
| 25 |
RStudio source editor, as if they were typed by a human. |
| 26 |
} |
| 27 |
\examples{ |
| 28 |
library(xfun) |
| 29 |
if (loadable("rstudioapi") && rstudioapi::isAvailable()) { |
| 30 |
rstudio_type("Hello, RStudio! xfun::rstudio_type() looks pretty cool!", |
| 31 |
pause = function() runif(1, 0, 0.5), mistake = 0.1) |
| 32 |
} |
| 33 |
} |