sourcing a file with the plot.lme() function
--- Roger Peng <rpeng at stat.ucla.edu> wrote:
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?
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._