You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello active user of sjmic really cool package (sjverse in general).
Problem: while recoding and labelling a variable i saw that my old labels weren't been passed by else=copy argument when i added new labels. Here the reprex:
#vector using dput() function
data<-structure(c(1, 0, 0, 0, 0, 0), label = "¿La municipalidad realizó procedimiento administrativo de Licencia de edificación para viviendas de hasta 5 pisos o 3000 m² ?", format.spss = "F12.0", display_width = 12L, labels = c(Si = 1,
No = 2), class = c("haven_labelled", "vctrs_vctr", "double"))
#(1) error not passing old labels when "adding" another
as.data.frame(data) %>% mutate( across(1, ~as_labelled(rec(., rec = '2=0[No];else=copy'))), ) %>% pull(1)
# <labelled<double>[6]>: ¿La municipalidad realizó procedimiento administrativo de Licencia de edificación para viviendas de hasta 5 pisos o 3000 m² ?
# [1] 1 0 0 0 0 0
#
# Labels:
# value label
# 0 No
#(2) desired result passing old labels
as.data.frame(data) %>% mutate( across(1, ~as_labelled(rec(., rec = '2=0;else=copy'))), ) %>% pull(1)
# <labelled<double>[6]>: ¿La municipalidad realizó procedimiento administrativo de Licencia de edificación para viviendas de hasta 5 pisos o 3000 m² ?
# [1] 1 0 0 0 0 0
#
# Labels:
# value label
# 0 No
# 1 Si
I think the behavior in (2) desired result passing old labels should also work in scenario (1) error not passing old labels when "adding another. In conclusion, it shouldn't drop labels 1 Si because i'm specifying that i want else=copy.
Let me know if its possible to fx this, thanks for the attention.
Regards
The text was updated successfully, but these errors were encountered:
Hello active user of
sjmic
really cool package (sjverse in general).Problem: while recoding and labelling a variable i saw that my old labels weren't been passed by
else=copy
argument when i added new labels. Here the reprex:I think the behavior in
(2) desired result passing old labels
should also work in scenario(1) error not passing old labels when "adding another
. In conclusion, it shouldn't drop labels1 Si
because i'm specifying that i wantelse=copy
.Let me know if its possible to fx this, thanks for the attention.
Regards
The text was updated successfully, but these errors were encountered: