Permalink
Browse files

Fix daply bug

  • Loading branch information...
hadley committed Apr 17, 2009
1 parent 5ba6a1e commit 25902b257e46c82f7ee408a716434ea19702467e
Showing with 3 additions and 1 deletion.
  1. +1 −0 NEWS
  2. +2 −1 R/simplify-array.r
View
1 NEWS
@@ -1,6 +1,7 @@
plyr 0.1.8 (2008-XX-XX) ---------------------------------------------------
* made rbind a little faster (~20%) using an idea from Richard Raubertas
+* daply now works correctly when splitting variables that contain empty factor levels
plyr 0.1.7 (2008-04-15) ---------------------------------------------------
View
@@ -42,7 +42,8 @@ list_to_array <- function(res, labels = NULL, .drop = FALSE) {
in_labels <- list(NULL)
in_dim <- n
} else {
- in_labels <- lapply(labels, unique)
+ in_labels <- lapply(labels,
+ function(x) if(is.factor(x)) levels(x) else unique(x))
in_dim <- sapply(in_labels, length)
}

0 comments on commit 25902b2

Please sign in to comment.