session: Functions for interacting with, saving and restoring R sessions.

> library(session)

バージョン: 1.0.3


関数名 概略
save.session Save and restore session information, including
loaded packages and attached data objects.
texteval Evaluate string(s) containing R commands and
return the text transcript or printed results

save.session / restore.session

セッションの保存と読み込み

> save.session(file = "session.Rda")
> restore.session(file = "session.Rda")

texteval / capture / printed

> script <- "x <- rnorm(100)\nlm(y~x)"
> 
> result <- texteval(script, "\n")
> cat(result)

> x <- rnorm(100)

> lm(y~x)

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x  
     0.4352      -0.2482
> result <- printed(script, "\n")
> cat(result)

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x  
    0.44428     -0.05803