Skip to content

Is there any reason for j to evaluate when i returns 0 rows? #2662

@MichaelChirico

Description

@MichaelChirico
DT = data.table(a = NA)
DT[!is.na(a), plot(density(a))]

This returns

Error in density.default(a) : argument 'x' must be numeric

I'm surprised we got to j. Is there any reason we'd want to evaluate j here?

I guess this is to cover grouping situations where we want to make sure each group returns the same shape, even if it has 0 rows?

If so, is there not something we can do to be smarter about how to handle this?

(in this situation, I'm not even sure what my expected output is, TBH)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions