Repository navigation
revdeps fail after names handling change #7145
Description
Activity
@jangorecki @MichaelChirico can you please investigate?
Reacted by Michael ChiricoI just saw those, thanks for filing. We may need to put that change through a formal deprecation cycle.
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 ERRORsinteresting 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
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.tablewithkeep.rownamescan pick up thexname automatically here:Line 50 in 4cf9a70
ans = data.table(rn=rownames(x), x, keep.rownames=FALSE) I haven't thought through yet what's the "correct" behavior, but on
masterthey both produceV1columns, which is at least consistent.At a glance, producing
xmay seem strange -- the user didn't provide anything namedx, so where did this mysterious name come from? One fix is to just explicitly passV1 = ...there...dtts, latrend, and vardpoor continue to fail after #7149.
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?
By way of more motivation for a breaking change:
data.table(cbind(1), cbind(2)) # V1 V1 # <num> <num> # 1: 1 2
Reacted by Toby Dylan HockingJust 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.
I guess this was fixed by #7158 revdep machine says this is now OK
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 NOTEsversus 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 haltedvardpoor failure is related to a different PR, #7266 so closing.
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
vardpoor