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
I was working on a SPSS data set where one of the variables has value labels but not a variable label, and I got an error when trying to run datasummary(). The error seems to occur in datasummary_extract(). Here's a small example to reproduce the error:
library(labelled)
library(modelsummary)
#> `modelsummary` 2.0.0 now uses `tinytable` as its default table-drawing#> backend. Learn more at: https://vincentarelbundock.github.io/tinytable/#> #> Revert to `kableExtra` for one session:#> #> options(modelsummary_factory_default = 'kableExtra')#> #> Change the default backend persistently:#> #> config_modelsummary(factory_default = 'gt')#> #> Silence this message forever:#> #> config_modelsummary(startup_message = FALSE)# v1 has variable labelv1<- labelled(
c(0L, 0L, 1L),
labels= c(yes=1, no=0),
label="V1"
)
data.frame(v1, y=1:3) |>
datasummary(formula=y~Mean)
Mean
y
2.00
# v2 has no variable labelv2<- labelled(
c(0L, 0L, 1L),
labels= c(yes=1, no=0)
)
data.frame(v2, y=1:3) |>
datasummary(formula=y~Mean)
#> Error in if (nrow(header) == 1) {: argument is of length zero
I was working on a SPSS data set where one of the variables has value labels but not a variable label, and I got an error when trying to run
datasummary()
. The error seems to occur indatasummary_extract()
. Here's a small example to reproduce the error:Created on 2024-04-18 with reprex v2.1.0
Session info
Thanks!
The text was updated successfully, but these errors were encountered: