0

I looked at this, but neither of the solutions are doing the job. The external tools like script, screen or tmux, what are they? packages?

Well basically what I want is this:

I have a script whit that code:

# my for loop
for (i in 1:10){
  print(i)
}

What I would like to save into a .txt file is this (all the things displayed at the console just as they are, when the code is run):

> for (i in 1:10){
+   print(i)
+ }
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9
[1] 10
> 

Just very simple line for line. Is there no simple solution for that?

sink() is not doing it, it just prints the output not the rest...

futile.logger, I tried but I did not work. Would be the right thing to use? I guess it could, but seems to be way beyond my needs.

Community
  • 1
  • 1
schluk5
  • 177
  • 2
  • 13

0 Answers0