pew_download
provides a programmatic and reproducible means to download survey datasets from the Pew Research Center
pew_download(
area = "politics",
file_id,
email = getOption("pew_email"),
password = getOption("pew_password"),
reset = FALSE,
download_dir = "pew_data",
msg = TRUE,
convert = TRUE,
delay = 3
)
One of the seven research areas of the Pew Research Center (see details).
The unique identifier (or optionally a vector of these identifiers) for the dataset(s) to be downloaded (see details).
Account information to submit to Pew Research Center (see details).
If TRUE, the register information will be reset. The default is FALSE.
The directory (relative to your working directory) to which files from the Pew Research Center will be downloaded.
If TRUE, outputs a message showing which data set is being downloaded.
If TRUE, converts downloaded file(s) to .RData format.
If the speed of your connection to the Pew Data Center is particularly slow,
pew_download
may encounter problems. Increasing the delay
parameter
may help.
The function downloads files.
The Pew Research Center has seven areas of research focus. Pass one of the
following strings to the area
argument to specify which area generated
the datasets you want to download:
politics
U.S. Politics & Policy (the default)
journalism
Journalism & Media
socialtrends
Social & Demographic Trends
religion
Religion & Public Life
internet
Internet & Technology
science
Science & Society
hispanic
Hispanic Trends
global
Global Attitudes & Trends
To avoid requiring others to edit your scripts to insert their own contact
information, the default is set to fetch this information from the user's
.Rprofile. Before running pew_download
, then, you should be sure to
add these options to your .Rprofile substituting your info for the example below:
options("pew_email" = "jherrera@uppermidwest.edu"
"pew_password" = "password123!")
# NOT RUN {
pew_download(file_id = c("september-2018-political-survey", "june-2018-political-survey"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab