pullData: Extracting event data from the UTD real-time event data...

View source: R/pullData.R

pullDataR Documentation

Extracting event data from the UTD real-time event data server.

Description

This is the main function to extract subdata from the UTD Event data server by country names and time ranges. The API key is required and can be obtained after filling out the form in the UTD event data sign-up website (http://eventdata.utdallas.edu/signup). Please follow the direction in the UTD sign-up webpage.
You can also use this function through the reference class, Table(). Please find the help document of the Table() function for more details for its usage.

Usage

pullData(utd_api_key = NULL, table_name = " ", country = list(),
  start = " ", end = " ", citation = TRUE)

Arguments

utd_api_key

An API key provided by the server manager at UTD.

table_name

The name of data table you want to have. You may find available data tables from DataTables( )

country

List of countries. We recommend to use the ISO ALPHA-3 Code format, but the full country name is also working in this function.
e.g. either list("USA","CAN") or list("United States", "Canada") are working and not case-sensitive.

start

The "YYYYMMDD" format of the first date of a data set

end

The "YYYYMMDD" format of the end date of a data set

citation

logical; If TRUE, then a package citation will be printed at the end of data retrival. The default is TRUE, and you can turn it off by adding FALSE in the option.

Value

A list with components

  • $data a data frame of requested data. An attribute of the data can be formatted as data.frame. Please check the features of data if it's necessary

  • $citation a text of the package citation

Examples

## Not run: pullData(utd_api_key=" ", table_name="Phoenix_rt", country=list("USA","MEX","SYR","CHN"),
 start="20171101", end="20171112", citation = TRUE)

 ## Another way to avoid repeating an API key into the function
 k <- '...api key...'
 subset1 <- pullData(k, "phoenix_rt", list('canada','China'), '20171101', '20171102')
 subset2 <- pullData(k, "icews", list('can', 'usa'), '20010101','20010110')
 subset3 <- pullData(k, 'cline_Phoenix_NYT',list('South Korea','canada'), '19551105','19581215')

 ## Data retreval without the citation
 pullData(k, "phoenix_rt", list("USA"), "20171115", "20171120", citation = FALSE)
## End(Not run)

KateHyoung/UTDEventData documentation built on Nov. 16, 2022, 2:29 p.m.