[R] xyplot does not find variable in data
gunter.berton at gene.com
Mon Oct 12 22:17:25 CEST 2009
>> What principle is at work?
> A strange one called "standard non-standard evaluation"; see
> for a nice overview by Thomas Lumley.
> ?xyplot says:
> data: For the 'formula' method, a data frame containing values (or
> more precisely, anything that is a valid 'envir' argument in
> 'eval', e.g. a list or an environment) for any variables in
> the formula, as well as 'groups' and 'subset' if applicable.
> If not found in 'data', or if 'data' is unspecified, the
> variables are looked for in the environment of the formula.
> For other methods (where 'x' is not a formula), 'data' is
> usually ignored, often with a warning.
> so the non-standard evaluation only applies to 'groups' and 'subset'.
> The list may be different for other functions, e.g., densityplot()
> also evaluates 'weights' in 'data'.
In addition, you might want to use with, as in:
with( Oats, xyplot(
yield ~ nitro,scales=list(x=list(at=unique(nitro))),
-- which standardizes the standard non-standardized evaluation I guess :-).
More information about the R-help