FILE.R <- tempfile(fileext = ".R")
this.path:::.writeCode({
this.path:::.withAutoprint({
shFILE(original = TRUE)
shFILE()
shFILE(default = {
stop("since 'FILE.R' will be found,\n",
"this error will not be thrown")
})
}, spaced = TRUE, verbose = FALSE, width.cutoff = 60L)
}, FILE.R)
this.path:::.Rscript(
c("--default-packages=this.path", "--vanilla", FILE.R)
)
unlink(FILE.R)
for (expr in c("shFILE(original = TRUE)",
"shFILE(original = TRUE, default = NULL)",
"shFILE()",
"shFILE(default = NULL)"))
{
cat("\n\n")
this.path:::.Rscript(
c("--default-packages=this.path", "--vanilla", "-e", expr)
)
}
Run the code above in your browser using DataLab