Skip to contents

This function prepares standard ASP data from Stata into a format ready for plotting with one of the included plotting functions.

Usage

sahel_prep_gg(data, key = "variable", value = "value", ...)

Arguments

data

Dataframe to pivot.

key

String. Name of the variable to pivot on.

value

String. Name of the value variable.

...

Additional agruments passed to tidyr::gather() such as variables to pivot or tidyselect expressions

Value

A plotting ready tibble.

Examples

sahel_sim_long_monetary <- tidyr::gather(sahel_sim, key = "variable",
                                         value = "value", hh_income,
                                         hh_consumption)
sahel_sim_long_count <- tidyr::gather(sahel_sim, key = "variable",
                                       value = "value", children_nr,
                                       animals_nr, yr_educ_hhmean)
sahel_sim_long_binary <- tidyr::gather(sahel_sim, key = "variable",
                                       value = "value", has_children,
                                       owns_animals, female_head)

dplyr::summarize(sahel_sim_long_monetary)
#> data frame with 0 columns and 1 row
dplyr::summarize(sahel_sim_long_count)
#> data frame with 0 columns and 1 row
dplyr::summarize(sahel_sim_long_binary)
#> data frame with 0 columns and 1 row