On 07/11/2017 3:01 PM, Tom Backer Johnsen wrote:
Dear R-help,

I am running a Mac under Sierra, with R version 3.4.2 and RStudio 1.1.383.  When 
running head () or tail () on an object in a script using source (<script 
name>) nothing appears in the output file, but if I use these commands in the 
normal R window the normal output appears.

What am I doing wrong?

You aren't printing the results. source() has an argument "print.eval" which defaults to FALSE; you can change it. A common way to do that is to set echo=TRUE, but echoing the input is not necessary.

So use

source(filename, echo = TRUE)

for a lot of output, or

source(filename, print.eval = TRUE)

for somewhat less.

In most cases an explicit print() will be needed if the head() or tail() is in a loop or in a function.

Duncan Murdoch

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to