Skip to content
Prev 164314 / 398503 Next

tapply within a data.frame: a simpler alternative?

baptiste auguie wrote:
You (as many before you) have overlooked the ave() function, which can
replace the ordering as well the do.call(c,tapply(....))

Also, I fail to see what good the melt()ing is for:
[1] 300   3
[1] 300   4

And the extra column is just "y"


my.df <- transform(my.df, norm=ave(y, group,
   function(.v) {.v / max(.v)}))
xyplot(norm + y ~ x,groups=group,  data=my.df, auto.key=T)