Skip to content

rowwiseDT with column of functions #7219

@kylebutts

Description

@kylebutts

I'm trying to create a column with functions using rowwiseDT. This creates an error.

Debugging, I see the current implementation checks needs_list = lengths(body) != 1L. This check, while simple, misses out on functions (or more generally anything that needs to be wrapped in list).

Reprex:

data.table::rowwiseDT(
  x=, func=,
  1e3, \(x) x + 1,
  1e4, \(x) x + 1,
  1e5, \(x) x + 1,
  1e6, \(x) x + 1
)
#> Error in rbindlist(body): invalid type/length (closure/4) in vector allocation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions