get_xSub {xSub} | R Documentation |
Get xSub file
Description
This function downloads individual files from www.x-sub.org
. Function produces a data.frame, for the user's choice of data source, country, spatial and temporal units, and (optionally) writes this data.frame to disk, in multiple formats.
Usage
get_xSub(
data_source,
sources_type = "individual",
data_type = "spatial panel",
country_iso3 = NULL,
country_name = NULL,
space_unit,
time_unit,
geo_window = "1 km",
time_window = "1 day",
dyad_type = "undirected",
out_dir = getwd(),
write_file = TRUE,
write_format = "csv",
verbose = FALSE
)
Arguments
data_source |
Name of data source. See |
sources_type |
Type of data sources ("individual" or "multiple"). Character string. |
data_type |
Type of dataset ("event" or "panel"). Character string. |
country_iso3 |
Country code (ISO3). See |
country_name |
Country name. See |
space_unit |
Geographic level of analysis. Character string. Can be one of |
time_unit |
Temporal level of analysis. Character string. Can be one of |
geo_window |
Geographic window (if source_type="multiple"). Could be either of "1 km" (default) or "5 km". Character string or vector. |
time_window |
Time window (if source_type="multiple"). Could be either of "1 day" (default) or "2 day". Character string or vector. |
dyad_type |
Time window (if source_type="multiple"). Could be either of "undirected" (default) or "directed". Character string or vector. |
out_dir |
Path to directory where files will be saved. |
write_file |
Logical. If |
write_format |
Output file format. Can be one of |
verbose |
Logical. When |
See Also
Examples
# Check which countries are available for ACLED
info_xSub(data_source="ACLED")
# Download ACLED data for Egypt, at country-year level
## Not run:
my_file <- get_xSub(data_source = "ACLED",country_iso3 = "EGY",
space_unit = "adm0",time_unit = "year")
## End(Not run)
# Download ACLED data for Egypt, at district-month level
## Not run:
my_file <- get_xSub(data_source = "ACLED",country_iso3 = "EGY",
space_unit = "adm2",time_unit = "month")
## End(Not run)
# With country name instead of ISO3 code
## Not run:
my_file <- get_xSub(data_source = "ACLED",country_name = "Egypt",
space_unit = "adm2",time_unit = "month")
## End(Not run)
## Not run:
# Download ACLED data for Egypt, event level
my_file <- get_xSub(data_source = "ACLED",country_iso3 = "EGY",
data_type = "event")
## End(Not run)
## Not run:
# Download multiple source data for Egypt, at province-month level
my_file <- get_xSub(sources_type = "multiple",country_iso3 = "EGY",
space_unit = "adm1",time_unit = "month", geo_window = "1 km",
time_window = "1 day", dyad_type = "undirected")
## End(Not run)