Prepare Sahel binary variables for plotting.
sahel_prep_gg_binary.Rd
Prepare Sahel binary variables for plotting.
Arguments
- data
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr)
- ...
Passed to group_by(), variables or computations to group by. Computations are always done on the ungrouped data frame. To perform computations on the grouped data, you need to use a separate mutate() step before the group_by(). Computations are not allowed in nest_by(). In ungroup(), variables to remove from the grouping.
- alpha
Signifiicance level for confidence interval
Examples
sahel_sim_long_binary <- tidyr::gather(sahel_sim, key = "variable",
value = "value", has_children,
owns_animals, female_head)
sahel_prep_gg_binary(sahel_sim_long_binary, country_names, variable,
alpha = 0.05)
#> # A tibble: 12 × 7
#> # Groups: country_names [4]
#> country_names variable mean sd se t CI
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Burkina Faso female_head 0.147 0.355 0.00915 1.96 0.0180
#> 2 Burkina Faso has_children 0.789 0.408 0.0105 1.96 0.0207
#> 3 Burkina Faso owns_animals 0.753 0.431 0.0111 1.96 0.0218
#> 4 Mauritania female_head 0.147 0.354 0.00792 1.96 0.0155
#> 5 Mauritania has_children 0.788 0.408 0.00913 1.96 0.0179
#> 6 Mauritania owns_animals 0.758 0.429 0.00959 1.96 0.0188
#> 7 Niger female_head 0.138 0.345 0.00814 1.96 0.0160
#> 8 Niger has_children 0.794 0.404 0.00953 1.96 0.0187
#> 9 Niger owns_animals 0.742 0.438 0.0103 1.96 0.0202
#> 10 Senegal female_head 0.134 0.340 0.00681 1.96 0.0133
#> 11 Senegal has_children 0.800 0.400 0.00800 1.96 0.0157
#> 12 Senegal owns_animals 0.744 0.437 0.00873 1.96 0.0171