I was trying to store the pretty-printed (formatted) output of sessionInfo
in a character variable and have found a solution using pretty.si <-capture.output(sessionInfo())
which results in a vector of character strings (one element per line).
Just out of curiosity:
Which function is called by R to get the pretty-printed output (e. g. I couldn't find a S3 print.sessionInfo
function)?
If I look into the implementation of sessionInfo
it just returns the unformatted result as list of lists or vectors:
> sessionInfo
function (package = NULL)
{
z <- list()
z$R.version <- R.Version()
z$platform <- z$R.version$platform
# ... omitted code ...
class(z) <- "sessionInfo"
z
}
Edit 1: BTW - To create a pretty-printed string from sessionInfo()
you can use:
si <- capture.output(print(sessionInfo()))