Skip to content

min/max fails on ordered factors when using by #1947

@mcieslik-mctp

Description

@mcieslik-mctp

It seems as this is a regression in the latest version (data.table_1.9.8), as it worked before

library(data.table)
test <- data.table(V1=factor(rep(c("a","b"), 10), levels=c("a", "b"), ordered=TRUE), 
V2=rep(c("c","d", "e", "f"), 5))
test[,min(V1)]           # (1)
test[,min(V1),by=V2]     # (2)

(1) correctly works but (2) returns an error:
Error in gmin(V1) : min is not meaningful for factors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions