Upcoming versions of base R eliminate the need for DT() functionality - consider eliminating?

Open
#5,621 17 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reading the issue discussion, the linked R-devel/News entry, and related issues #5559, #5430, and #5129. The work is complete when maintainers decide whether DT() should be removed from the roadmap and that decision is recorded; the payload does not identify implementation files or tests.

Written by the indexing model from the issue text.

Description

DT() top request

As an experimental feature the placeholder _ can now also be used in the ‘rhs’ of a forward pipe |> expression as the first argument in an extraction call, such as _$coef. More generally, it can be used as the head of a chain of extractions, such as _$coef[[2]].

R-devel/News, Mon, 13 Feb 2023

In upcoming versions of R, syntax such as the following will be supported:

as.data.table(mtcars) |> 
  _[am == 1] |> 
  _[, .(maxhp = max(hp)), by = .(cyl)]

#    cyl maxhp
# 1:   6   175
# 2:   4   113
# 3:   8   335

With this in mind, I think it's worth reconsidering whether DT() should remain on the release roadmap.

Some arguments in favor of scrapping DT() are as follows:

  • Base R functionality dt |> _[...] will address all use cases for DT()
  • Introducing an alternate syntax for calling [.data.table will be confusing for new users. Advertising this functionality also eliminates an opportunity to educate users about existing dt[...][...] chaining capabilities baked in by default
  • Exporting DT() will lead to namespace collision issues with the DT::DT() exported by the widely used DT package
  • DT() acceptance of non data.table objects is likely to cause user confusion
    • #5559
    • #5430
    • #5129
  • Supporting DT() going forward will be a drain on valuable maintainer's time - DT() Labeled Issues
  • DT() has not yet been exported in a CRAN release so no there will no impacts to reverse dependencies and limited impact to users who have adopted this form

That being said, this is just my two cents as a satisfied user of data.table interested in the long term success of the package. Happy to hear counter arguments, and open to the idea that the broader community may see enough value to finish the push to support DT().

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.