pew_download provides a programmatic and reproducible means to download survey datasets from the Pew Research Center
pew_download(area = "politics", file_id, name = getOption("pew_name"), org = getOption("pew_org"), phone = getOption("pew_phone"), email = getOption("pew_email"), download_dir = "pew_data", msg = TRUE, unzip = TRUE, delete_zip = TRUE)area argument to specify which area generated
the datasets you want to download:
politics U.S. Politics & Policy (the default)
journalism Journalism & Media
internet Internet, Science & Tech
religion Religion & Public Life
hispanic Hispanic Trends
global Global Attitudes & Trends
socialtrends Social & Demographic 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_name" = "Juanita Herrera",
"pew_org" = "Upper Midwest University",
"pew_phone" = "888-000-0000",
"pew_email" = "jherrera@uppermidwest.edu")
## Not run:
# pew_download(file_id = c(20059299, 20058139))
# ## End(Not run)
Run the code above in your browser using DataLab