The function may also execute provided expressions or files. The implementation is based on r_vanilla.

clean_session(expr = c(), script_file = NULL, rmd_file = NULL,
  echo = FALSE, predetect = TRUE,
  repos = "https://cloud.r-project.org")

Arguments

expr

vector of expressions to be executed in the session (see quote)

script_file

R script to be executed in the session, uses source

rmd_file

R Markdown file to rendered in the session, uses render

echo

print out detailed information from R

predetect

whether to use automagic to install missing packaging before executing the R script or R Markdown file

repos

Repository to use, requried if expr incluedes install statements

Examples

clean_session(c(quote(library('lattice'))))
#> INFO [2019-08-20 16:43:55] Creating an R session with the following expressions: #> library("lattice")
#> R version 3.6.1 (2019-07-05) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 19.04 #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0 #> #> locale: #> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C #> [3] LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8 #> [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8 #> [7] LC_PAPER=de_DE.UTF-8 LC_NAME=C #> [9] LC_ADDRESS=C LC_TELEPHONE=C #> [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] lattice_0.20-38 #> #> loaded via a namespace (and not attached): #> [1] compiler_3.6.1 grid_3.6.1