R: Make sure command output is piped to sink()
In an R script when using sink() to output the results of commands to a file you will often get a blank file whereas if you copy and paste the same command into the R shell it will work fine. There are two ways round this:
- Wrap all commands with the print() fucntion
- When sourcing the file make sure that echo is set to TRUE i.e. source("input.r", echo=TRUE)
Comments