LAPOP Save
lapop_save.Rd
This function creates exports graphs created using the LAPOP templates.
Examples
if (FALSE) df <- data.frame(
cat = c("Far Left", 1, 2, 3, 4, "Center", 6, 7, 8, 9, "Far Right"),
prop = c(4, 3, 5, 12, 17, 23, 15, 11, 5, 4, 1),
proplabel = c("4%", "3%", "5%", "12%", "17%", "23%", "15%", "11%", "5%", "4%", "1%")
)
myfigure <- lapop_hist(df,
main_title = "Centrists are a plurality among Peruvians",
subtitle = "Distribution of ideological preferences",
source_info = "Peru, 2019",
ymax = 27
)
#> Error in ggplot(data, aes(x = factor(cat_var, levels = cat_var), y = outcome_var)): `data` cannot be a function.
#> ℹ Have you misspelled the `data` argument in `ggplot()`
f <- file.path(tempdir(), "fig1.svg")
lapop_save(myfigure, f, format = "svg", width_px = 800)
#> Error: object 'myfigure' not found
# \dontrun{}