download_data: Download IUROPA data

View source: R/download_data.R

download_dataR Documentation

Download IUROPA data

Description

This function allows you to download data from the IUROPA CJEU Database via the IUROPA API. This function provides the same functionality as the IUROPA Download Tool, which is available on the IUROPA website. You need to choose a component in the IUROPA CJEU Database and a table in that component. For example, you could choose the decisions table of the CJEU Database Platform. You can specify filters to select specific observations and you can select specific variables. You can use describe_variables() to learn more about the variables available in each table.

Usage

download_data(
  component,
  table,
  filters = NULL,
  variables = NULL,
  session = NULL
)

Arguments

component

A string. The code for a component. Use list_components() to get a list of valid values.

table

A string. The name of a table in the specified component. Use list_tables() to get a list of valid values.

filters

A named list. The default is NULL. Each element in the list specifies a filter to apply to the data. The name of each element should be the name of a variable in the specified table and the corresponding value should be a value or vector of values that the variable can take. The results will only include observations where the variable equals one of the provided values. If you specify multiple filters, the results will only include observations that match all of the filters. For numeric variables, you can add _min or _max to the end of the variable name to specify a minimum or maximum value. The API will ignore invalid filters.

variables

A string vector. The default is NULL. The results will only include the variables in the vector. Use list_variables() to get a list of valid values. The function will throw an error if you provide an invalid variable name.

session

An object of class iuropa_session created by authenticate(). This argument is only required for content that is not yet publicly available.

Details

The IUROPA API has a rate limit, so this function downloads data from the IUROPA API in batches. It downloads 25,000 observations every 5 seconds. It prints a message to the console that indicates how many observations you have requested and approximately how long it will take to download the data. It also prints a message after every batch that indicates the current progress. After your download is complete, it will print the suggested citations for the data. Please use these citations if you use the data in a paper.

Value

This function returns a tibble containing the requested data.

Examples

## Not run: 
data <- download_data(
  component = "cjeu_database_platform",
  table = "decisions",
  filters = list(
    court = c("Court of Justice", "General Court")
  )
)

data <- download_data(
  component = "cjeu_database_platform",
  table = "assignments",
  filters = list(
    court = "Court of Justice",
    decision_date_min = "2015-01-01"
  ),
  variables = c("iuropa_decision_id", "iuropa_judge_id", "judge")
)
## End(Not run)


jfjelstul/iuropa documentation built on July 25, 2024, 4:11 p.m.