I want to write comments, input and output of an R-script to a file. Writing input and output to the file seems to be working fine, but the comments don't show up.
How can I write the comments to a file as well?
I have a main script that runs another script with different settings. In the main script I run the other script with:
source("script.R", echo=T)
In "script.R" I write the output to a file with:
sink(paste(directory,"result.txt",sep=""),type=c("output","message"))
I then run the main script with:
Rscript --vanilla mainScript.R