script.new | R Documentation |
This function opens a new R script, R markdown script, or SQL script in RStudio.
script.new(text = "", type = c("r", "rmarkdown", "sql"),
position = rstudioapi::document_position(0, 0),
run = FALSE, check = TRUE)
text |
a character vector indicating what text should be inserted in the new R script. By default, an empty script is opened. |
type |
a character string indicating the type of document to be
created, i.e., |
position |
|
run |
logical: if |
check |
logical: if |
This function uses the documentNew()
function in the rstudioapi
package by Kevin Ushey, JJ Allaire, Hadley Wickham, and Gary Ritchie (2023).
Takuya Yanagida takuya.yanagida@univie.ac.at
Ushey, K., Allaire, J., Wickham, H., & Ritchie, G. (2023). rstudioapi: Safely access the RStudio API. R package version 0.15.0 https://CRAN.R-project.org/package=rstudioapi
script.close
, script.open
,
script.save
, script.copy
, setsource
## Not run:
# Example 1: Open new R script file
script.new()
# Example 2: Open new R script file and run some code
script.new("#----------------------------
# Example
# Generate 100 random numbers
rnorm(100)")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.