Skip to content

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

Closed

Description

@arunsrinivasan

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)

Activity

  1. 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[/+] on Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions