pew_download {pewdata}R Documentation

Download datasets from the Pew Research Center

Description

pew_download provides a programmatic and reproducible means to download survey datasets from the Pew Research Center

Usage

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
)

Arguments

area

One of the seven research areas of the Pew Research Center (see details).

file_id

The unique identifier (or optionally a vector of these identifiers) for the dataset(s) to be downloaded (see details).

email, password

Account information to submit to Pew Research Center (see details).

reset

If TRUE, the register information will be reset. The default is FALSE.

download_dir

The directory (relative to your working directory) to which files from the Pew Research Center will be downloaded.

msg

If TRUE, outputs a message showing which data set is being downloaded.

convert

If TRUE, converts downloaded file(s) to .RData format.

delay

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.

Details

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!")

Value

The function downloads files.

Examples

## Not run: 
 pew_download(file_id = c("september-2018-political-survey", "june-2018-political-survey"))

## End(Not run)


[Package pewdata version 0.3.2 Index]