survey_cor_matrix | R Documentation |
This function wraps jtools::svycor() so that it works in a srvyr-pipeline, runs bootstrapped significance-tests and calculates weighted summary statistics. Only numeric variables are included in the result.
survey_cor_matrix(svy_df, var_names)
svy_df |
A survey object created with the survey or srvyr package. Only numeric variables will be included in the result. |
var_names |
Named character vector to rename variables to - most helpful if return is to be passed to some print function |
A correlation matrix list in the format provided by
jtools::svycor()
with the addition of a desc
-element with means
and standard deviations of the variables.
## Not run: if (requireNamespace("survey") & requireNamespace("srvyr")) { library(survey) library(srvyr) data(api) dstrat <- apistrat %>% as_survey_design(1, strata = stype, fpc = fpc, weight = pw) var_names <- c(meals = "Share subsidized meals", ell = "English language learners", growth = "Performance Change") # Print correlation matrix survey_cor_matrix(dstrat, var_names) } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.