Skip to content

revdeps fail after names handling change #7145

Description

@tdhock

131af20 is responsible for several new revdep issues:

https://rcdata.nau.edu/genomic-ml/data.table-revdeps/analyze/2025-07-08/

dtts tests (output too large to be useful here) search for "checking tests" in https://rcdata.nau.edu/genomic-ml/data.table-revdeps/analyze/2025-07-08/dtts.txt

tidytable

* checking tests ...
  Running 'testthat.R'
 ERROR
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(tidytable)
  
  Attaching package: 'tidytable'
  
  The following object is masked from 'package:testthat':
  
      matches
  
  The following objects are masked from 'package:stats':
  
      dt, filter, lag
  
  The following object is masked from 'package:base':
  
      %in%
  
  > 
  > test_check("tidytable")
  [ FAIL 1 | WARN 2158 | SKIP 0 | PASS 1335 ]
  
  == Failed tests ================================================================
  -- Failure ('test-as_tidytable.R:23:3'): works ---------------------------------
  Names of `.m` ('id', 'x') don't match 'id', 'V1'
  
  [ FAIL 1 | WARN 2158 | SKIP 0 | PASS 1335 ]
  Error: Test failures
  Execution halted

vardpoor


* checking examples ... ERROR
Running examples in 'vardpoor-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: vardannual
> ### Title: Variance estimation for measures of annual net change or annual
> ###   for single and multistage stage cluster sampling designs
> ### Aliases: vardannual
> ### Keywords: vardannual
> 
> ### ** Examples
> 
>  
> ### Example
> library("data.table")
> 
> set.seed(1)
> 
> data("eusilc", package = "laeken")
> eusilc1 <- eusilc[1:20, ]
> rm(eusilc)
> 
> dataset1 <- data.table(rbind(eusilc1, eusilc1),
+                        year = c(rep(2010, nrow(eusilc1)),
+                                 rep(2011, nrow(eusilc1))))
> rm(eusilc1)
> 
> dataset1[, country := "AT"]
> dataset1[, half := .I - 2 * trunc((.I - 1) / 2)]
> dataset1[, quarter := .I - 4 * trunc((.I - 1) / 4)]
> dataset1[age < 0, age := 0]
> 
> PSU <- dataset1[, .N, keyby = "db030"][, N := NULL][]
> PSU[, PSU := trunc(runif(.N, 0, 5))]
> 
> dataset1 <- merge(dataset1, PSU, all = TRUE, by = "db030")
> rm(PSU)
> 
> dataset1[, strata := "XXXX"]
> dataset1[, employed := trunc(runif(.N, 0, 2))]
> dataset1[, unemployed := trunc(runif(.N, 0, 2))]
> dataset1[, labour_force := employed + unemployed]
> dataset1[, id_lv2 := paste0("V", .I)]
> 
> vardannual(Y = "employed", H = "strata",
+            PSU = "PSU", w_final = "rb050",
+            ID_level1 = "db030", ID_level2 = "id_lv2",
+            Dom = NULL, Z = NULL, years = "year",
+            subperiods = "half", dataset = dataset1,
+            percentratio = 100, confidence = 0.95,
+            method = "cros")
Warning in melt.data.table(DTagg, id = c(namesperc, gnamesDom), measure = varsYZ,  :
  measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change).
Warning in melt.data.table(DT2, id = namesperc, measure = varsYZ, variable.factor = FALSE) :
  measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change).
Error in setnames(annual_var, c("V1"), c("var")) : 
  Items of 'old' not found in column names: [V1]. Consider skip_absent=TRUE.
Calls: vardannual ... FUN -> setnames -> stopf -> raise_condition -> signal
Execution halted

Activity

  1. tdhock commented on Jul 8, 2025

    @tdhock
    MemberAuthor

    @jangorecki @MichaelChirico can you please investigate?

  2. MichaelChirico commented on Jul 8, 2025

    @MichaelChirico
    Member

    I just saw those, thanks for filing. We may need to put that change through a formal deprecation cycle.

  3. added this to the 1.18.0 milestone on Jul 8, 2025
  4. tdhock commented on Jul 8, 2025

    @tdhock
    MemberAuthor

    this also affects library(latrend) https://rcdata.nau.edu/genomic-ml/data.table-revdeps/analyze/2025-07-07/latrend.txt
    with the following two check diffs using R-devel:

    -* checking examples ... OK
    +* checking examples ... ERROR
    +Running examples in 'latrend-Ex.R' failed
    +The error most likely occurred in:
    +
    +> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    +> ### Name: test.latrend
    +> ### Title: Test the implementation of an lcMethod and associated lcModel
    +> ###   subclasses
    +> ### Aliases: test.latrend
    +> 
    +> ### ** Examples
    +> 
    +> test.latrend("lcMethodRandom", tests = c("method", "basic"), clusterRecovery = "skip")
    +Error: data must comprise at least 10 trajectories
    +Execution halted
     * checking for unstated dependencies in 'tests' ... OK
     * checking tests ... OK
       Running 'testthat.R'
     * checking for unstated dependencies in vignettes ... OK
     * checking package vignettes ... OK
    -* checking re-building of vignette outputs ... OK
    +* checking re-building of vignette outputs ... ERROR
    +Error(s) in re-building vignettes:
    +--- re-building 'demo.Rmd' using rmarkdown
    +---------------------------------------------------------------------------
    +- Longitudinal clustering using: longitudinal k-means (KML)
    +---------------------------------------------------------------------------
    +Method arguments:
    + time:           getOption("latrend.time")
    + id:             getOption("latrend.id")
    + nClusters:      2
    + nbRedrawing:    1
    + maxIt:          200
    + imputationMethod:"copyMean"
    + distanceName:   "euclidean"
    + power:          2
    + distance:       function() {}
    + centerMethod:   meanNA
    + startingCond:   "nearlyAll"
    + nbCriterion:    1000
    + scale:          TRUE
    + response:       "Y"
    +---------------------------------------------------------------------------
    +Checking and transforming the training data format.
    +Preparing the training data for fitting...
    +Fitting the method...
    +Done fitting the method (0.34 secs)
    +---------------------------------------------------------------------------
    +--- finished re-building 'demo.Rmd'
    +
    +--- re-building 'implement.Rmd' using rmarkdown
    +
    +Quitting from lines 76-77 [unnamed-chunk-5] (implement.Rmd)
    +Error: processing vignette 'implement.Rmd' failed with diagnostics:
    +length(clusterNames) not greater than 0
    +--- failed re-building 'implement.Rmd'
    +
    +--- re-building 'simulation.Rmd' using rmarkdown
    +--- finished re-building 'simulation.Rmd'
    +
    +SUMMARY: processing the following file failed:
    +  'implement.Rmd'
    +
    +Error: Vignette re-building failed.
    +Execution halted
    +
     * checking PDF version of manual ... OK
     * DONE
    -Status: OK
    +Status: 2 ERRORs
    

    interesting that these do not show up on the check machine using R-4.5.1 because there are errors for those checks with both versions of data.table

  5. MichaelChirico commented on Jul 8, 2025

    @MichaelChirico
    Member

    It looks like we've introduced some undesirably inconsistent behavior:

    (xx = cbind(setNames(1:3, letters[1:3])))
    #   [,1]
    # a    1
    # b    2
    # c    3
    
    as.data.table(xx)
    #       V1
    #    <int>
    # 1:     1
    # 2:     2
    # 3:     3
    as.data.table(xx, keep.rownames='id')
    #        id     x
    #    <char> <int>
    # 1:      a     1
    # 2:      b     2
    # 3:      c     3

    That's because as.data.table with keep.rownames can pick up the x name automatically here:

    ans = data.table(rn=rownames(x), x, keep.rownames=FALSE)

    I haven't thought through yet what's the "correct" behavior, but on master they both produce V1 columns, which is at least consistent.

    At a glance, producing x may seem strange -- the user didn't provide anything named x, so where did this mysterious name come from? One fix is to just explicitly pass V1 = ... there...

  6. MichaelChirico commented on Jul 10, 2025

    @MichaelChirico
    Member

    dtts, latrend, and vardpoor continue to fail after #7149.

  7. MichaelChirico commented on Jul 10, 2025

    @MichaelChirico
    Member

    For {dtts}, here is the crux of the issue:

    data.table(index = 1, 1)
    #    index    V2
    #    <num> <num>
    # 1:     1     1
    
    # before #4363
    data.table(index = 1, cbind(1))
    #    index    V1
    #    <num> <num>
    # 1:     1     1
    
    # after / current master
    data.table(index = 1, cbind(1))
    #    index    V2
    #    <num> <num>
    # 1:     1     1

    I think the new behavior is better, but I reckon this still warrants a deprecation cycle, WDYT @jangorecki?

  8. MichaelChirico commented on Jul 11, 2025

    @MichaelChirico
    Member

    By way of more motivation for a breaking change:

    data.table(cbind(1), cbind(2))
    #       V1    V1
    #    <num> <num>
    # 1:     1     2
  9. jangorecki commented on Jul 11, 2025

    @jangorecki
    Member

    Just before the release it is not good to introduce breaking change so better keep it as coming, to test with an option, as you did in PR, and change from the next release.

  10. tdhock commented on Jul 30, 2025

    @tdhock
    MemberAuthor

    I guess this was fixed by #7158 revdep machine says this is now OK

  11. tdhock commented on Aug 31, 2025

    @tdhock
    MemberAuthor

    revdep machine says that vardpoor is again failing but with a different error:

    
    -* checking examples ... OK
    +* checking examples ... ERROR
    +Running examples in 'vardpoor-Ex.R' failed
    +The error most likely occurred in:
    +
    +> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    +> ### Name: vardannual
    +> ### Title: Variance estimation for measures of annual net change or annual
    +> ###   for single and multistage stage cluster sampling designs
    +> ### Aliases: vardannual
    +> ### Keywords: vardannual
    +> 
    +> ### ** Examples
    +> 
    +>  
    +> ### Example
    +> library("data.table")
    +> 
    +> set.seed(1)
    +> 
    +> data("eusilc", package = "laeken")
    +> eusilc1 <- eusilc[1:20, ]
    +> rm(eusilc)
    +> 
    +> dataset1 <- data.table(rbind(eusilc1, eusilc1),
    ++                        year = c(rep(2010, nrow(eusilc1)),
    ++                                 rep(2011, nrow(eusilc1))))
    +> rm(eusilc1)
    +> 
    +> dataset1[, country := "AT"]
    +> dataset1[, half := .I - 2 * trunc((.I - 1) / 2)]
    +> dataset1[, quarter := .I - 4 * trunc((.I - 1) / 4)]
    +> dataset1[age < 0, age := 0]
    +> 
    +> PSU <- dataset1[, .N, keyby = "db030"][, N := NULL][]
    +> PSU[, PSU := trunc(runif(.N, 0, 5))]
    +> 
    +> dataset1 <- merge(dataset1, PSU, all = TRUE, by = "db030")
    +> rm(PSU)
    +> 
    +> dataset1[, strata := "XXXX"]
    +> dataset1[, employed := trunc(runif(.N, 0, 2))]
    +> dataset1[, unemployed := trunc(runif(.N, 0, 2))]
    +> dataset1[, labour_force := employed + unemployed]
    +> dataset1[, id_lv2 := paste0("V", .I)]
    +> 
    +> vardannual(Y = "employed", H = "strata",
    ++            PSU = "PSU", w_final = "rb050",
    ++            ID_level1 = "db030", ID_level2 = "id_lv2",
    ++            Dom = NULL, Z = NULL, years = "year",
    ++            subperiods = "half", dataset = dataset1,
    ++            percentratio = 100, confidence = 0.95,
    ++            method = "cros")
    +Error in t(X) %*% A_matrix : non-conformable arguments
    +Calls: vardannual -> lapply -> FUN -> data.table
    +Execution halted
     * checking PDF version of manual ... OK
     * DONE
    -Status: 2 NOTEs
    +Status: 1 ERROR, 2 NOTEs
    

    versus before the error at the same line in those examples was:

    
    Warning in melt.data.table(DTagg, id = c(namesperc, gnamesDom), measure = varsYZ,  :
      measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change).
    Warning in melt.data.table(DT2, id = namesperc, measure = varsYZ, variable.factor = FALSE) :
      measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change).
    Error in setnames(annual_var, c("V1"), c("var")) : 
      Items of 'old' not found in column names: [V1]. Consider skip_absent=TRUE.
    Calls: vardannual ... FUN -> setnames -> stopf -> raise_condition -> signal
    Execution halted
    
  12. reopened this on Aug 31, 2025
  13. tdhock commented on Oct 21, 2025

    @tdhock
    MemberAuthor

    vardpoor failure is related to a different PR, #7266 so closing.

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

    revdepReverse dependencies

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions