`tab_multi_manager()` fails with a named character vector
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 73/100
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: 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InseeFrLab/rtauargus
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
InseeFrLab/rtauargus#63 ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
InseeFrLab/rtauargus#68 · 1 comentario ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
InseeFrLab/rtauargus#66 ·
-
Improve some error messagesAbiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
InseeFrLab/rtauargus#58 ·
-
Améliorer le message renvoyé par `analyse_metadata`Quizá libre de nuevo @clara-baudry la tomó hace 117 días y no hay ningún pull request abierto. Abierto
InseeFrLab/rtauargus#48 · 2 comentarios · 1 asignado ·
Todos los issues de InseeFrLab/rtauargus
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
restatedev/sdk-typescript#813 ·
-
[18.0] werkzeug: AttributeErrorAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
odoo/odoo#297927 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Merit-Systems/x402scan#1312 ·
-
type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure/apiops-cli#331 ·
Los mantenedores suelen responder en 3 días