Skip to content

Segfault in dcast because of type mismatch in fun.aggregate #2394

@khotilov

Description

@khotilov

With the latest release and development data.table versions, the following example results in a segfault with no warning:

library(data.table)
agg <- function(x) if(length(x) > 0) min(x) else NA
d <- data.table(id = c(1,1,2,2), x = c('y','y','y','z'), v = c('a','b','c','d'))
dcast(d, formula = id ~ x, fun.aggregate = agg, value.var = 'v')

Careless use of NA instead of NA_character_ in the aggregation function is my fault. But I hope such errors could be handled more gracefully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions