These are helper functions to wrangle labels and produce visualizations of 'AmericasBarometer' data following LAPOP Lab's editorial guidelines.
🔗 Package website: https://lapop-central.github.io/lapop/
To install the package in your console, run:
devtools::install_github("lapop-central/lapop",
force = TRUE,
build_vignettes = TRUE)
For the full online guide, see:
📖 LAPOP Data Guide for R Users
'AmericasBarometer' datasets are distributed in Stata .dta format with multilingual metadata (question wording and response options) embedded as attributes. These support cross-national and longitudinal comparability.
Use:
readstata13::read.dta13()
to preserve the full metadata structure.
Other methods such as haven::read_dta() or rio::import() may fail to import the STATA attributes.
expansion.fields attribute.lpr_extract_notes() to convert into a tidy data frame.lpr_set_attr() using the appropriate noteid.label.table attribute.lpr_set_ros() to assign these response labels in English, Spanish, or Portuguese.r
library(lapop)
r
lapop_fonts()
r
lpr_data()
lpr graph type:lpr_hist()lpr_cc()lpr_ts()lpr_mover() 5. Store the output in an R object.
Examples:
Use the corresponding lapop plotting function to produce the visualization:
Examples: lapop_hist(), lapop_cc(), lapop_ts(), etc.
7. Export the figure to your machine with:
r
lapop_save()
lapop R PackageR/ folder.devtools::document() to generate .Rd files in man/ and update NAMESPACE.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.