[R] By processing on two variables at once?

hadley wickham h.wickham at gmail.com
Thu Nov 12 16:24:00 CET 2009


>> aggregate(dat$value, list(dat$x, dat$y), mean)
>  Group.1 Group.2  x
> 1       1       1 15
> 2       1       2 30
>> newdat <-aggregate(dat$value, list(dat$x, dat$y), mean)
>> names(newdat) <- c("x","y",bquote("mean(value)") )

That bquote isn't necessary because you're already working with strings.
c(x = 1, y = 2, "mean(value)" = 3)

Hadley

-- 
http://had.co.nz/




More information about the R-help mailing list