Permalink
Browse files

Fix incompatibility with plyr 1.8

  • Loading branch information...
hadley committed Dec 4, 2012
1 parent 52fa7b9 commit 9866807f776827abd3e8b6c2a4255f76ec2c2fc4
Showing with 4 additions and 0 deletions.
  1. +2 −0 NEWS
  2. +2 −0 R/cast.r
View
2 NEWS
@@ -1,3 +1,5 @@
+* Fix incompatibility with plyr 1.8
+
* Fix evaluation bug revealed by knitr. (Fixes #18)
* Fixed a bug in `melt` where it didn't automatically get variable names
View
@@ -117,6 +117,8 @@ cast <- function(data, formula, fun.aggregate = NULL, ..., subset = NULL, fill =
overall <- id(rev(ids), drop = FALSE)
ns <- vapply(ids, attr, 0, "n")
+ # Replace zeros (empty inputs) with 1 for dimensions of output
+ ns[ns == 0] <- 1
n <- attr(overall, "n")
# Aggregate duplicates

0 comments on commit 9866807

Please sign in to comment.