Skip to content
Prev 105758 / 398506 Next

lattice: defining an own function using args for "formula" and "groups"

x.fun <- function( formula, data ) dotplot( formula, data )
x.grp <- function( formula, groups, data ) dotplot( formula, groups, data )

data( barley )
# no problem
# no problem
object "year" not found 	# that's my error, so I do:
Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
9: eval(substitute(groups), data, environment(formula))
8: bwplot.formula(x = formula, data = c(2, 2, 2, 2, 2, 2, 2, 2,  ...

Why it is a problem calling x.grp() and no problem calling x.fun() ?
What could I do to get work x.grp() ?

Thanks - Wolfram