toolCountryFill: Tool: CountryFill

View source: R/toolCountryFill.R

toolCountryFillR Documentation

Tool: CountryFill


This function expects a MAgPIE object with ISO country codes in the spatial dimension. These ISO codes are compared with the official ISO code country list (stored as supplementary data in the madrat package). If there is an ISO code in the data but not in the official list this entry is removed, if an entry of the official list is missing in the data this entry is added and set to the value of the argument fill.


  fill = NA,
  no_remove_warning = NULL,
  overwrite = FALSE,
  verbosity = 1,
  countrylist = NULL,



MAgPIE object with ISO country codes in the spatial dimension


Number which should be used for filling the gaps of missing countries.


A vector of non-ISO country codes that exist in the data and that should be removed by CountryFill but without creating a warning (they will be removed in any case). You should use that argument if you are certain that the given entries should be actually removed from the data.


logical deciding whether existing data should be overwritten, if there is a specific mapping provided for that country, or not


verbosity for information about filling important countries. 0 = warning will show up (recommended if filling of important countries is not expected), 1 = note will show up in reduced log file (default), 2 = info will show up in extended log file (recommended if filling of important countries is not critical and desired).


character vector of official country names (if other than ISO)


Mappings between countries for which the data is missing and countries from which the data should be used instead for these countries (e.g. "HKG"="CHN" if Hong Kong should receive the value of China). This replacement usually only makes sense for intensive values. Can be also provided as a argument called "map" which contains a named vector of these mappings.


A MAgPIE object with spatial entries for each country of the official ISO code country list.


Jan Philipp Dietrich


x <- new.magpie("DEU", 1994, "bla", 0)
y <- toolCountryFill(x, 99)

madrat documentation built on Aug. 23, 2023, 5:10 p.m.