afrb_build: Build a local copy of the Afrobarometer database

Description Usage Arguments Details Value See Also Examples

View source: R/afrb-build.R

Description

Automates the downloading and merging of the Afrobarometer data. Fetches any missing, publicly available files, creates a master MonetDB database in options(afrobarometer.data), and merges available spatial data with the questionnaires for each round.

Usage

1
afrb_build(rounds = 1:6, overwrite = FALSE)

Arguments

rounds

A sequence of integers indicating which rounds to build. As of February 2017, there are six rounds. Default is value 1:6.

overwrite

A boolean value indicating whether or not the SQLite database in the local Afrobarometer data directory should be overwritten when afrb_build is run. Default is FALSE.

Details

May only run afrb_round after afrb_dir and before afrb_round.

Value

Builds the database in options("afrobarometer.data"), downloading files as needed into sub-directories and merging the resulting data file.path(options("afrobarometer.data"), "build").

See Also

afrb_dir

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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 is already populated with merged tables.
afrb_build(rounds = 3:4)
# download all rounds and overwrite the existing database.
afrb_build(rounds = 3:4, overwrite = TRUE)
r3 <- afrb_round(round = 3)

## End(Not run)

sboysel/afrobarometer documentation built on May 29, 2019, 3:24 p.m.