gaut
gaut

Reputation: 5958

'split' is not an exported object from 'namespace:data.table'

running data.table::split returns an Error: 'split' is not an exported object from 'namespace:data.table'. Any idea why?

enter image description here

Upvotes: 2

Views: 706

Answers (1)

Zheyuan Li
Zheyuan Li

Reputation: 73415

split is a generic function defined in base. Package data.table just adds a new "data.table" method to it.

## S3 method for class 'data.table'
split(x, f, drop = FALSE,
      by, sorted = FALSE, keep.by = TRUE, flatten = TRUE,
      ..., verbose = getOption("datatable.verbose"))

You can go for data.table:::split.data.table.


So this behavior is expected? It seems weird to me. Shouldn't data.table::split point to data.table:::split.data.table?

It might be easier for you to consider print. This is also a generic function. Does every package need to redefine it and make an R session a mess? No. A common practice is to add a new method by defining print.xxx.

Upvotes: 4

Related Questions