Skip to content

sourcing a file with the plot.lme() function

3 messages · Roger D. Peng, Brian Ripley, Deepayan Sarkar

#
I ran into a problem trying to make a plot from a file that's read using
source.  Basically, I have the following code in a file "plot.R" :

library(nlme)
data(Loblolly)
fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
            data = Loblolly,
            fixed = Asym + R0 + lrc ~ 1,
            random = Asym ~ 1,
            start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
windows(6,6)
plot(fm1)

This code is taken from the help page for 'nlme'.  If I cut an paste this
code into the console, everything works as expected.  However, if I try to
execute the code by calling source("plot.R") the plot is never made.  Has
anyone seen this?
_              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    5.1            
year     2002           
month    06             
day      17             
language R              

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Isn't that a lattice plot?  Those need to be printed explicitly.
On Tue, 27 Aug 2002, Roger Peng wrote:

            

  
    
#
--- Roger Peng <rpeng at stat.ucla.edu> wrote:
This is caused by not using an explicit print() around the "trellis" object
returned by plot(). Unlike conventional graphics, trellis/lattice functions
don't actually draw anything; the actual plotting is done by the default print
method for the object returned.

print(plot(fm1))

should work.

Deepayan


__________________________________________________

Yahoo! Finance - Get real-time stock quotes

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._