[R] Problem w/ source
Douglas Bates
bates at stat.wisc.edu
Thu Jul 24 17:27:10 CEST 2003
Well, we feel that source does work the way that it is documented to
work. Please read the documentation and notice that the entire file
is evaluated as one step in the read-eval-print loop. If you want to
print the results of individual function calls you will need to change
your script to
print(ls())
print("hello")
print(sum(y1))
print(mean(y1))
Peter Muhlberger <peterm at andrew.cmu.edu> writes:
> I'm trying to use the source command to run commands from a file. For
> instance: source("do.R"), where do.R is a file in the same directory in
> which I am running R.
>
> The contents of do.R are:
>
> ls()
> print("hello")
> sum(y1)
> mean(y1)
>
>
> After source("do.R"), all I see is:
>
> > source("do.R")
> [1] "hello"
>
>
> I'm using the X11 version of R for Mac OS X (downloadable binary). Does
> anyone know how to get source to work?
>
> Thanks!
>
> Peter
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
--
Douglas Bates bates at stat.wisc.edu
Statistics Department 608/262-2598
University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/
More information about the R-help
mailing list