Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcast.data.table should error when fun.aggregate value for missing combinations is of length 0, but no fill value is provided #715

Closed
arunsrinivasan opened this issue Jul 3, 2014 · 0 comments
Assignees
Labels

Comments

@arunsrinivasan
Copy link
Member

While fixing #713, came across another potential bug that needs to be fixed.

library(data.table)
DT <- data.table(id=rep(1:2, c(3,2)), k=c(letters[1:3], letters[1:2]), v=1:5)

Now, if we do:

dcast.data.table(DT, id ~ k, fun.aggregate=last)

this should result in error, beause last(integer(0)) is integer(0), which is not of length 1. The error message should indicate this and provide the solution that the function needs to be modified or fill= argument has to be explicitly set. Ex:

dcast.data.table(DT, id ~ k, fun.aggregate=last, fill=NA)
@arunsrinivasan arunsrinivasan changed the title dcast.data.table should error when fun.aggregate value for missing argument is of length 0, but no fill value is provided dcast.data.table should error when fun.aggregate value for missing combinations is of length 0, but no fill value is provided Jul 3, 2014
@arunsrinivasan arunsrinivasan self-assigned this Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant