Skip to content

substitute2 and env argument missing from data.table 1.14.2 on CRAN? #5369

Description

@ChristopherEeles

Problem

According to the "Programming on data.table" vignette:

Starting from version 1.14.2, data.table provides a robust mechanism for parameterizing expressions passed to the i, j, and by (or keyby) arguments of [.data.table. It is built upon the base R substitute function, and mimics its interface. Here, we introduce substitute2 as a more robust and more user-friendly version of base R’s substitute.

However, on installation substitute2 is unavailable and using the env argument in [.data.table errors.

Am I losing my mind, I swear this worked before?

Reprex

remove.packages("data.table")
install.packages("data.table", type="source")

library(data.table)
# data.table 1.14.2 using 6 threads (see ?getDTthreads).  Latest news: r-datatable.com

?substitute2
# No documentation for ‘substitute2’ in specified packages and libraries:
# you could try ‘??substitute2’

data.table::substitute2
# Error: 'substitute2' is not an exported object from 'namespace:data.table'

dt <- data.table(a=letters[1:5], b=rnorm(5))
dt[, col, env=list(col="b")]
# Error in `[.data.table`(dt, , col, env = list(col = "b")) : 
#  unused argument (env = list(col = "b"))

sessionInfo

R Under development (unstable) (2021-12-19 r81394)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.14.2

loaded via a namespace (and not attached):
[1] compiler_4.2.0

Activity

  1. tlapak commented on Apr 12, 2022

    @tlapak
    Contributor

    That's a mistake in the vignette. If you check the news you'll find the entry under the current dev version, so it'll be included in the next release (barring the discovery of a major major bug). 1.14.2 was basically just a hotfix to accommodate a change in R's tooling. So that's likely how it happened.

  2. ChristopherEeles commented on Apr 12, 2022

    @ChristopherEeles
    Author

    That is unfortunate, I wrote some functions in my Bioconductor package CoreGx using this feature 😅.

    Time for some messier meta programming I guess lol.

    Thanks,
    Christopher Eeles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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