Either change your script by adding print(...) calls where you want to see something printed or change the call to source() by adding print.eval=TRUE or echo=TRUE. E.g.,
> cat(file = tf <- tempfile(), "head(10:1)\ntail(letters)\nx <- gamma(0:4)\nx\n") > source(tf) Warning message: In gamma(0:4) : NaNs produced > source(tf, print.eval=TRUE) [1] 10 9 8 7 6 5 [1] "u" "v" "w" "x" "y" "z" [1] NaN 1 1 2 6 Warning message: In gamma(0:4) : NaNs produced > source(tf, echo=TRUE, print.eval=TRUE) > head(10:1) [1] 10 9 8 7 6 5 > tail(letters) [1] "u" "v" "w" "x" "y" "z" > x <- gamma(0:4) > x [1] NaN 1 1 2 6 Warning message: In gamma(0:4) : NaNs produced > Calling options(warn=1) before calling source() will keep the warnings near the lines that caused them. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Nov 7, 2017 at 12:01 PM, Tom Backer Johnsen <[email protected]> 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? > > Tom Backer Johnsen > University of Bergen > Norway > ______________________________________________ > [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. > [[alternative HTML version deleted]] ______________________________________________ [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.

