Skip to content


aaply bug when all the values in any column are NA #169

Derek-Jones opened this Issue · 3 comments

2 participants


If all the values in any column are NA then a weird error occurs, see below.
This looks like unintended behavior, i.e., an error, to me?

If any element of a column is not NA the error does not occur.

Only tried it with aaply (which is where I found it).

t1=data.frame(a=c(1, 2, 3), b=c(NA, 1, NA))
aaply(t1, 1, function(df) return(1))
1 2 3
1 1 1

t2=data.frame(a=c(1, 2, 3), b=c(NA, NA, NA))
aaply(t2, 1, function(df) return(1))
Error in dim(out_array) <- out_dim :
dims [product 0] do not match the length of object [3]


This works for me:

daply(t2, 1, function(df) return(1))

I'm using plyr1.8 with R 15.3. Recently installed everything on a new machine (64bit Intel, running Suse 12.3).

Also get the problem from RStudio on an AMD box running Windows XP (plyr1.8 with R 15.3)


I get the same error you see when calling aaply. When using daply (which is preferred, since t2 is a data frame after all), everything is fine.

@hadley hadley closed this in d0be1df
@wibeasley wibeasley added a commit to wibeasley/plyr that referenced this issue
@hadley Don't drop missing values when sorting.
Closes #169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.