(Apologies for the n00b question.) Hello, I'm teaching R in an introductory programming course and am walking the students through the baby steps. One thing I'd like to be able to do is have them copy the commands they type at the R console into a text file, and then execute the text file to see the results. For instance, if their session looks like this:
3+4 [1] 7 factorial(10) [1] 3628800 I'd like for them to create a text file called "myCommands.R" with contents: 3+4 factorial(10) and then run it at the R console using source("myCommands.R"), and see this output: [1] 7 [1] 3628800 This would help with many things, including my grading their lab work. Unfortunately, if I/they do this using the source() command as it stands, the result is of course no output at all, because nothing is being explicitly printed (with print() or cat() command, for example). My question is: is there a command to do what I'm trying to do here? Is there some kind of "verbose source" command (or mode) that will run a .R script/program/file and print all the results from it exactly as if those commands had been entered at the console? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.