[R] filtering in aggregate
Antonio Olinto
aolinto_r at bignet.com.br
Wed Mar 15 01:28:39 CET 2006
Hello all,
I have a data frame with year, month, species, fishing gear and catch
(Y, M, S, F, C) and I want the sum of C by Y for species "A" and fishing
gear "trawl".
I tried things like aggregate(C[S=="A" & F=="trawl"], list (Year =
Y[S=="A" & F=="trawl"]), fun=sum), but it didn't worked.
To overcome this problem I did a subset as a new data frame and then I
used aggregate. But I'm sure there's a way to apply a filter in data frame.
Thanks for any help. Best regards.
Antonio Olinto
More information about the R-help
mailing list