I would like to save the output of "sessionInfo()" to a text file. Using "write()" failed because "list() cannot be handled by 'cat()'". I then tried "save()" with ascii = T but the resulting file is not really helpful.
I would like to have an output like this in a text file. Any easy, straightforward way to do this?
First – we're reading the contents of the Reader into a String; then we're simply writing the String to File. 2. With Guava The Guava solution is simpler – we now have the API to deal with writing the reader to file:
Writing in this screen-reader friendly style means you are writing in a screen-friendly style, which makes for a better user experience for all customers and visitors on all devices. Structure your content logically so that it can be easily navigated. Titles – use a clear title that describes the topic or purpose.
Writing in this screen-reader friendly style means you are writing in a screen-friendly style, which makes for a better user experience for all customers and visitors on all devices. Structure your content logically so that it can be easily navigated.
Capture the screen output into a character vector and use writeLines
.
writeLines(capture.output(sessionInfo()), "sessionInfo.txt")
‘sink’ diverts R output to a connection.
sink("sessionInfo.txt") sessionInfo() sink()
sessionInfo.txt:
R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.0.2 tools_3.0.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With