-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add by=
variable to tbl_svysummary(include=)
by default
#925
Comments
hi @coreysparks ! thanks for the post! you'll need to add the library(gtsummary)
dhs<-haven::read_dta("https://github.com/coreysparks/data/blob/master/ZZIR62FL.DTA?raw=true")
dhs<-haven::zap_labels(dhs)
dhs$v005<- dhs$v005/1000000
dhs2<- select(dhs, v021, v022, v005, v139, v151)
names(dhs2)
#> [1] "v021" "v022" "v005" "v139" "v151"
library(dplyr); library(gtsummary)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
options(survey.lonely.psu = "adjust")
survey::svydesign(ids = ~v021,
strata=~v022,
weights = ~v005,
data=dhs2)%>%
tbl_svysummary(by = "v139", include = c(v151, v139)) %>%
as_kable() # convert to kable to display on github
Created on 2021-06-22 by the reprex package (v2.0.0) |
ddsjoberg
changed the title
Issue with complex survey and tbl_svysummary, column does not exist
Add Jun 22, 2021
by=
variable to tbl_svysummary(include=)
by default
Gotcha! Thanks for the swift reply! |
14 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I may have found a bug, below is reproducible code to generate the error. I expect to get a simple summary of variable v151 for the levels of v139, but I get an error stating
Brief description of the problem.
The text was updated successfully, but these errors were encountered: