Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`tab_multi_manager()` fails with a named character vector

Abierto Apto para principiantes
#67 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
73/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
r
Área
backend

Línea de trabajo

El fallo está en summarize_secret(), donde se pasa var a dplyr::all_of() dentro de dplyr::rename_with(); el issue no indica el archivo fuente ni una prueba. Encuentra esa función y reproduce la llamada con un valor con nombre, como c(variableInteret = "EMPL"). La tarea se considera completada cuando la columna correspondiente se renombra a VALUE sin errores para vectores de caracteres con nombre, y las entradas sin nombre existentes siguen funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Bug: tab_multi_manager() fails with a named character vector in previously working processing pipelines

Description

A call to tab_multi_manager() fails in summarize_secret() when the value argument is a named character vector rather than an unnamed character string.

This issue did not occur with previous versions: existing processing pipelines that previously ran successfully now fail with the error described below.

For example, cluster[[1]]$nomVarValue may contain:

c(variableInteret = "EMPL")

rather than:

"EMPL"

The names attribute of the vector causes dplyr::rename_with() to fail when var is passed to all_of(var).

Steps to reproduce

liste_tbx_res <- tab_multi_manager(
  list_tables = lTables,
  list_explanatory_vars = lVars,
  alt_hrc = lHrc,
  alt_totcode = lTotaux,
  value = cluster[[1]]$nomVarValue,
  freq = cluster[[1]]$nomVarFreq,
  dir_name = file.path(
    getOption("rtauargus.tauargus_output"),
    sNomcluster
  ),
  cost_var = "cost_var",
  secret_no_pl = "secret_no_pl"
)

When cluster[[1]]$nomVarValue is a named character vector, the call fails with the following error:

Error in `purrr::map()`:
i In index: 1.
i With name: ape_EMPL_ceff7.

Caused by error in `dplyr::rename_with()`:
! Can't rename variables in this context.

The error originates from the following code in summarize_secret():

res_tau %>%
  {
    if (!is.null(var)) {
      dplyr::rename_with(., ~ "VALUE", dplyr::all_of(var))
    } else {
      .
    }
  }

Expected behavior

The function should continue to accept the named character vectors produced by existing processing pipelines and rename the corresponding column to VALUE without raising an error.

Actual behavior

Processing pipelines that worked with previous versions now fail in dplyr::rename_with() when var retains its names attribute.

Proposed fix

Remove the names attribute before passing var to all_of():

res_tau %>%
  {
    if (!is.null(var)) {
      dplyr::rename_with(., ~ "VALUE", dplyr::all_of(unname(var)))
    } else {
      .
    }
  }

Alternatively, normalize var at the beginning of summarize_secret():

if (!is.null(var)) {
  var <- unname(var)
}

Additional information

The issue is resolved by passing unname(value) instead of value to summarize_secret(). The underlying variable name ("EMPL") is valid; the problem appears to be related to the vector's names attribute.

This is a regression affecting existing processing pipelines that worked with previous versions. The version in which the behavior changed remains to be identified.

Lenguaje dominante
HTML
Estrellas
12
Forks
6
Merge medio
36 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de InseeFrLab/rtauargus

Todos los issues de InseeFrLab/rtauargus

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.