The afrobarometer package automates downloading and merging the Afrobarometer Survey Data into the R workspace.
There are three exported functions of the afrobarometer package:
Sets the Afrobarometer data directory to
afrb_build merges available data for the survey rounds
specified by the integer vector
the existing built data is overwritten.
Extracts merged data for Round
build subdirectory of
getOption("afrobarometer.data") into a
Open access data is downloaded if needed. The user is expected to manually
set the optional restricted access data in the
of the Afrobarometer data directory,
such as spatial locations of survey respondents.
1 2 3 4 5 6 7 8 9 10 11 12
## Not run: library(afrobarometer) afrb_dir(path = "~/foo") # download first 3 rounds but do not overwrite the existing database. # This will fail if the database has already been built. afrb_build(rounds = 3:4) # download all rounds (rounds 1 through 6) and overwrite the existing database. afrb_build(rounds = 3:4, overwrite = TRUE) # load round 4 from the database into a data.frame afrb4 <- afrb_round(4) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.