> 
> In this simple case you can just coerce directly to a vector like so:
> 
> > foo <- by(dat, dat$GROUP, function(x) {weighted.mean(x$VALUE,
> x$FREQUENCY)})
> > bar <- as.vector(foo)
> 
> but look at the examples for ?by; in particular the use of 'sapply'.
> 
> Norm

As a general practice, I believe unlist() is preferable. ?unlist explains
why.

Cheers,
Bert Gunter

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to