On Mon, 17 Sep 2018, MacQueen, Don wrote:
I'm also going to guess that maybe your object rainfall_by_site has
already been split into separate data frames (because of its name). But
by() does the splitting internally, so you should be passing it the
original unsplit data frame.
Don,
I did not pick up on by() doing the splitting for me when I read the help
file and a few web sites!
Using the unsplit data.frame did the job; e.g.,
rainfall[, "name"]: Sandy 1.4 NE
[1] 0.1636066
------------------------------------------------------------
rainfall[, "name"]: Sandy 1.7 SSW
[1] 0.2021324
------------------------------------------------------------
rainfall[, "name"]: Sherwood 3.3 SE
[1] 0.1461752
Now I know how to properly apply by() to an unsplit dataframe. Thanks for
the insightful lesson.
Best regards,
Rich
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.