[R] Applying by() when groups have different lengths [RESOLVED]
Rich Shepard
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Mon Sep 17 21:56:04 CEST 2018
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
More information about the R-help
mailing list