Skip to content

gmedian failing on simple case #2046

@caneff

Description

@caneff

On 1.10.4:

dt <- data.table(x=c(1,1,1),y=c(3,0,0))
setkey(dt, x)
dt[, median(y), by=x]

Yields the following error:
Error in gmedian(y) : negative length vectors are not allowed

If dt doesn't have a key set, it doesn't throw the error (but I can't tell if gmedian is even being called in that case). Also calling stats::median instead of median above works because it bypasses gmedian directly.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions