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'm encountering an error when converting a tbl_svysummary object to a flextable using as_flex_table() when it has a p-value from the svy.wald.test. This seems to have broken between release 1.5.0 and 1.5.1. See reprexes below: the first code chunk works when outputting to html.
The error doesn't occur with the default Wilcoxon rank sum test. The code appears to be choking because the p-value is stored as matrix rather than a single numeric value, but I don't know what change was introduced to cause the bug.
The text was updated successfully, but these errors were encountered:
Thank you for letting me know! The p-value column was being saved as a nX1 matrix in the data frame, as opposed to a numeric vector. I'll need to fix that, but in the meantime, you can use the code below to get a working table.
library(gtsummary)
data(api, package="survey")
dstrat<-survey::svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
tbl<-
tbl_svysummary(
dstrat,
by=awards,
include= c(api00, api99)
) %>%
add_p(test=list(all_continuous() ~"svy.wald.test")) %>%
# convert these columns to numeric vectors (somehow was stored as a nX1 matrix)
modify_table_body(
~.x %>% dplyr::mutate(dplyr::across(c(statistic, p.value), as.numeric))
)
as_flex_table(tbl)
Hi there,
I'm encountering an error when converting a
tbl_svysummary
object to a flextable usingas_flex_table()
when it has a p-value from the svy.wald.test. This seems to have broken between release 1.5.0 and 1.5.1. See reprexes below: the first code chunk works when outputting to html.Created on 2022-02-15 by the reprex package (v2.0.1)
But the second fails when converting.
Created on 2022-02-15 by the reprex package (v2.0.1)
The error doesn't occur with the default Wilcoxon rank sum test. The code appears to be choking because the p-value is stored as matrix rather than a single numeric value, but I don't know what change was introduced to cause the bug.
The text was updated successfully, but these errors were encountered: