[R] lattice: defining an own function using args for formula and groups

2006-12-08 Thread Wolfram Fischer
x.fun - function( formula, data ) dotplot( formula, data ) x.grp - function( formula, groups, data ) dotplot( formula, groups, data ) data( barley ) x.fun( variety ~ yield | site, data=barley ) # no problem dotplot( variety ~ yield | site, groups=year, data=barley ) # no problem x.grp(

Re: [R] lattice: defining an own function using args for formula and groups

2006-12-08 Thread Gabor Grothendieck
Don't know of a more straight forward way but this works. It constructs a new call to bwplot from the one to x.grp2 and evaluates it in the parent environment: library(lattice) x.grp2 - function(x, groups, data) { cl - match.call() cl[[1]] - as.name(bwplot) eval.parent(cl) } x.grp2(