Bug 15699 - aggregate() fails for formula with RHS ~ 1
Summary: aggregate() fails for formula with RHS ~ 1
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Accuracy (show other bugs)
Version: R-devel (trunk)
Hardware: All Windows 64-bit
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-03-04 12:01 UTC by Daniel Wollschlaeger
Modified: 2014-03-04 14:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Wollschlaeger 2014-03-04 12:01:52 UTC
Up to including R 3.0.2, the following was possible to calculate the overall mean:

dat <- data.frame(Y=runif(10), X=sample(LETTERS[1:3], 10, TRUE))
aggregate(Y ~ 1, FUN=mean, data=dat)

In R 3.0.3RC, this error is returned:

Error in split.default(e, grp) : group length is 0 but data length > 0

I cannot pinpoint the release from where this failed, but it was before 3.0.3RC.
Comment 1 Duncan Murdoch 2014-03-04 14:12:23 UTC
Fixed in R-devel (to become 3.1.0).  Too late to slip into 3.0.3.