set_spam_par sets all required parameters for spam to run, including: model folders, country, year, resolution, administrative unit information, solve level and model type.

set_spam_par(
  spam_path = NULL,
  raw_path = NULL,
  iso3c_sel = NULL,
  year_sel = NULL,
  grid_sel = "5min",
  adm_sel = 1,
  solve_sel = 0,
  model_sel = "max_score"
)

Arguments

spam_path

character string with the main SPAM folder. Note that R uses forward slash or double backslash to separate folder names.

raw_path

character string with the raw data folder. This makes it possible to store the raw data on a server. If raw_path is not specified it is automatically set to the default raw data folder in the main model folder.

iso3c_sel

character string with the three letter ISO 3166-1 alpha-3 country code, also referred to as iso3c. A list of country codes can be found in Wikipedia.

year_sel

numeric with the reference year for SPAM.

grid_sel

character with the resolution of SPAM. Accepted inputs are "5min" (default) and "30sec".

adm_sel

integer with the level up to which subnational statistics are available. Accepted inputs are 0 (only national level data), 1 (national level and first level administrative unit - default) and 2 (national level, first and second level administrative unit).

solve_sel

integer that indicates the level at which the model is solved. Accepted inputs are 0 (model is run at national level - default) and 1 (model is solved for each first level administrative unit separately). level and first level administrative unit - default)

model_sel

character that specifies the type of model that is run. Accepted inputs are "max_score" and "min_entropy". See package documentation for more information.

Value

spam_par object

Details

set_spam_par creates an object of class spam_par, which bundles all required spam parameters set by the user, including: core model folders, country, year, resolution, depth of administrative units for which subnational statistics are available, level at which the model is solved and type of model.

create_spam_folders needs to be run before as it creates all core folders, including the parameters folder where set_spam_par output is stored. An error will be thrown if these essential folders do not exist when the function is run.

countrycode is used to determine the full country name, three digit country code, three digit FAO country code and continent on the basis of the alpha-3 country code. This information is required to extract country specific information from several datasets.

Examples

if (FALSE) { set_spam_par(spam_path = "C:/Users/dijk158/spam_mwi", iso3c_sel = "MWI", year_sel = 2010, grid_sel = "5min", adm_sel = 1, solve_sel = 0, model_sel = "max_score") }