[R] xyplot does not find variable in data
Peter Ehlers
ehlers at ucalgary.ca
Mon Oct 12 23:46:58 CEST 2009
One other way that is sometimes useful is to use the
tick.number argument as in:
xyplot(yield ~ nitro, data=Oats,
scales=list(x=list(tick.number=4)), subset=Variety=="Victory"
)
This is especially handy if you want to just tick/label
every other value.
-Peter Ehlers
Jacob Wegelin wrote:
> When we call a lattice function such as xyplot, to what extent does
> the "data" designation cause the function to look inside the "data"
> for variables?
>
> In the examples below, the "subset" argument understands that
> "Variety" is a variable in the data.
>
> But the "scales" argument does not understand that "nitro" is a
> variable in the data.
>
> What principle is at work?
>
>
> library(MEMSS)
>
> # The following works fine:
>
> xyplot(
> yield ~ nitro
> , data=Oats
> , scales=list(
> x=list(
> at=unique(Oats$nitro)
> )
> )
> , subset=Variety=="Victory"
> )
>
> # But the following returns an error:
>
> xyplot(
> yield ~ nitro
> , data=Oats
> , scales=list(
> x=list(
> at=unique(nitro)
> )
> )
> )
>
> Thanks for any insight
>
> Jacob A. Wegelin
> Assistant Professor
> Department of Biostatistics
> Virginia Commonwealth University
> 730 East Broad Street Room 3006
> P. O. Box 980032
> Richmond VA 23298-0032
> U.S.A.
> E-mail: jwegelin at vcu.edu
> URL: http://www.people.vcu.edu/~jwegelin
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>
>
More information about the R-help
mailing list