Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
Derek-Jones opened this Issue · 3 comments

2 participants

@Derek-Jones

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]

@krlmlr

This works for me:

daply(t2, 1, function(df) return(1))
@Derek-Jones

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)

@krlmlr

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 referenced this issue from a commit in wibeasley/plyr
@hadley Don't drop missing values when sorting.
Closes #169
8956d85
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.