get_xSub: Get xSub file

Description Usage Arguments See Also Examples

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

1
2
3
4
5
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 info_xSub() for full list.

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 info_xSub() for full list.

country_name

Country name. See info_xSub() for full list.

space_unit

Geographic level of analysis. Character string. Can be one of "adm0" (country), "adm1" (province), "adm2" (district), "priogrid" (grid cell), "clea" (electoral constituency). See info_xSub(details=TRUE) for availability by country.

time_unit

Temporal level of analysis. Character string. Can be one of "year", "month", "week", "day". See info_xSub(details=TRUE) for availability by country.

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_file=TRUE, selected file will be written to disk, at location specified by out_dir.

write_format

Output file format. Can be one of "csv" (comma-separated values, default), "R" (RData format, compatible with R statistical programming language), "STATA" (dta format, compatible with Stata 14).

verbose

Logical. When verbose=TRUE, file download progress is printed to console.

See Also

info_xSub, get_xSub_multi

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Check which countries are available for ACLED
info_xSub(data_source="ACLED")

# Download ACLED data for Egypt, at country-year level
my_file <- get_xSub(data_source = "ACLED",country_iso3 = "EGY",
           space_unit = "adm0",time_unit = "year")

# 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)

zhukovyuri/xSub documentation built on May 22, 2019, 12:40 p.m.