I'm new to lattice and can't figure out what the problem is with the following example: #########################> library(lattice)Loading required package: grid Attaching package `lattice': The following object(s) are masked _by_ .GlobalEnv : xyplot The following object(s) are masked from package:base : levels> test.data <- data.frame(x=rnorm(100),+ y=rnorm(100), + group=gl(5,20))> xyplot(y~x|group,data=test.data,+ panel=function(x,y,subscripts,df) { + text(x,y,labels=as.character(df[subscripts,"group"])) + abline(lm(y~x)) + },df=test.data) Error in unique(by) : Argument "by" is missing, with no default>######################### I get the same error when I try the examples from the `xyplot' help page: #########################> data(quakes) > xyplot(long ~ lat , data = quakes)Error in unique(by) : Argument "by" is missing, with no default>######################### What am I missing?> version_ platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.0 year 2001 month 12 day 19 language R Thanks, Sundar -- Sundar Dorai-Raj, Ph.D. Statistical Methods Engineer PDF Solutions, Inc. (972) 889-3085 x216 (214) 392-7619 cell sundard at pdf.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 22 Apr 2002, Sundar Dorai-Raj wrote:> I'm new to lattice and can't figure out what the problem is with the > following example: > > ######################### > > library(lattice) > Loading required package: grid > > Attaching package `lattice': > > > The following object(s) are masked _by_ .GlobalEnv : > > xyplot >^^^^^^ You have a function xyplot() in your global environment, and you're using that function rather than the one in the 'lattice package' You probably want to do rm(xyplot) before loading 'lattice' -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Two problems: 1) You have a version of xyplot in your workspace: see the message you quoted. 2) Your R version is old, and may not match your version of lattice. On Mon, 22 Apr 2002, Sundar Dorai-Raj wrote:> I'm new to lattice and can't figure out what the problem is with the > following example: > > ######################### > > library(lattice) > Loading required package: grid > > Attaching package `lattice': > > > The following object(s) are masked _by_ .GlobalEnv : > > xyplot > > > The following object(s) are masked from package:base : > > levels > > > test.data <- data.frame(x=rnorm(100), > + y=rnorm(100), > + group=gl(5,20)) > > xyplot(y~x|group,data=test.data, > + panel=function(x,y,subscripts,df) { > + text(x,y,labels=as.character(df[subscripts,"group"])) > + abline(lm(y~x)) > + },df=test.data) > Error in unique(by) : Argument "by" is missing, with no default > > > ######################### > > I get the same error when I try the examples from the `xyplot' help > page: > > ######################### > > data(quakes) > > xyplot(long ~ lat , data = quakes) > Error in unique(by) : Argument "by" is missing, with no default > > > ######################### > > What am I missing? > > > > version > _ > platform i386-pc-mingw32 > arch x86 > os Win32 > system x86, Win32 > status > major 1 > minor 4.0 > year 2001 > month 12 > day 19 > language R > > Thanks, > > Sundar > > -- > > Sundar Dorai-Raj, Ph.D. > Statistical Methods Engineer > PDF Solutions, Inc. > (972) 889-3085 x216 > (214) 392-7619 cell > sundard at pdf.com > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._