Title: | Data processor for IMPACT model (Data prOcessor fOR iMpAcT) |
---|---|
Description: | Data processor for IMPACT model. |
Authors: | Abhijeet Mishra [aut, cre] |
Maintainer: | Abhijeet Mishra <[email protected]> |
License: | GPL (>= 3) |
Version: | 3.14.1 |
Built: | 2024-10-27 04:50:36 UTC |
Source: | https://github.com/IFPRI/DOORMAT |
Function to aggregate IMPACT results at a specified level
aggregateIMPACT( df = NULL, level = "regglo", aggr_type = "sum", sp_mapping = "Standard-IMPACT_dis1", keep_cty = FALSE )
aggregateIMPACT( df = NULL, level = "regglo", aggr_type = "sum", sp_mapping = "Standard-IMPACT_dis1", keep_cty = FALSE )
df |
Specific IMPACT results as a list object. Likely output of readGDX |
level |
"reg" Short for regional. "regglo" for regional+global result being passed on to this function |
aggr_type |
sum or mean |
sp_mapping |
Column from Aggregation Regions sheet |
keep_cty |
Overwriting flag for regional aggregation. If set to TRUE, provides only country level data. |
Country or FPU level aggregation of IMPACT results
Abhijeet Mishra
## Not run: aggregateIMPACT() ## End(Not run)
## Not run: aggregateIMPACT() ## End(Not run)
Build package utility
buildPackage(lib = ".", quiet = FALSE, ignore_lintr = FALSE)
buildPackage(lib = ".", quiet = FALSE, ignore_lintr = FALSE)
lib |
Path to library |
quiet |
If CMD check output is sent to terminal. Set to TRUE if additional info is not needed |
ignore_lintr |
If lintr should be ignored for readability |
Abhijeet Mishra
## Not run: buildPackage() ## End(Not run)
## Not run: buildPackage() ## End(Not run)
Build package utility for DRAT linkage of IFPRI R packages
drat_source_build(lib = ".")
drat_source_build(lib = ".")
lib |
Path to library |
Abhijeet Mishra
## Not run: drat_source_build() ## End(Not run)
## Not run: drat_source_build() ## End(Not run)
Function to get IMPACT mapping for crops, activities, regions(from country) This function is just a glorified file reader as you can provide any mapping you want. See description below.
findMapping(name = NULL, file = "default_mappings.xlsx", multimap = FALSE, ...)
findMapping(name = NULL, file = "default_mappings.xlsx", multimap = FALSE, ...)
name |
Name of mapping to get. You can provide any name here but the options when using default mapping are
If using the "multimap" switch for this function. Your mapping MUST have the first column named "type" which should contain the same text as "name" parameter of this function. For example, if the "type" column is filled with "blabla" then the "name" parameter here should also be called "blabla". In default example, for crops, the "type" column is filled with "c" in the default file. |
file |
Mapping file in excel format. Uses the file provided with this package by default. |
multimap |
If the mapping file contains multiple mappings in single file. See the "default_mappings.xlsx" file provided with this package for example. There, single excel file contains "j", "c" and "cty" mappings. You have to stick to naming conventions described above if you activate this switch. Defaults to FALSE. Set it to TRUE if using multiple mapping in 1 file If "multimap" is set to TRUE, your mapping MUST have the first column named "type" which should contain the same text as "name" parameter of this function. For example, if the "type" column is filled with "blabla" then the "name" parameter here should also be called "blabla". In default example, for crops, the "type" column is filled with "c" in the default file. |
... |
All other parameters to be passed on to read_xlsx function for reading the excel file of mapping using read_xlsx. See ?read_xlsx. |
Abhijeet Mishra
## Not run: getMapping(name = "c") ## End(Not run)
## Not run: getMapping(name = "c") ## End(Not run)
R utility package for reading objects from a GDX file.
readGDX( gdx, name, use_model_name = "IMPACT", verbosity = FALSE, quick_df = FALSE )
readGDX( gdx, name, use_model_name = "IMPACT", verbosity = FALSE, quick_df = FALSE )
gdx |
Path to the gdx file |
name |
name of the parameter being read |
use_model_name |
Which model name should be shown. Use "IMPACT" for IMPACT results. |
verbosity |
If additional messages should be printed about variable being read |
quick_df |
if description and model name column should be dropped |
Parameter and domain of gdx output result queried
Abhijeet Mishra
## Not run: readGDX() ## End(Not run)
## Not run: readGDX() ## End(Not run)
Function which pulls the domain list
tool_get_domain_mapping(domain = NULL, file = "mapping_items.xlsx")
tool_get_domain_mapping(domain = NULL, file = "mapping_items.xlsx")
domain |
set |
file |
Mapping file |
Mapping object for IMPACT framework
Abhijeet Mishra
## Not run: tool_get_mapping() ## End(Not run)
## Not run: tool_get_mapping() ## End(Not run)
Function for getting correct mapping of IFPRI regions (CTY to regions)
tool_get_mapping( type = NULL, file = "mapping_items.xlsx", sheet = NULL, sp_mapping = "Standard-IMPACT_dis1" )
tool_get_mapping( type = NULL, file = "mapping_items.xlsx", sheet = NULL, sp_mapping = "Standard-IMPACT_dis1" )
type |
Defaults to "cty" for country mapping. Choose "fpu" for IMPACT FPU mapping. |
file |
Mapping file |
sheet |
Sheet from which data is read. Ideally output of tool_get_domain_mapping function |
sp_mapping |
Column from Aggregation Regions sheet |
Mapping object for IMPACT framework
Abhijeet Mishra
## Not run: tool_get_mapping() ## End(Not run)
## Not run: tool_get_mapping() ## End(Not run)
Simple update for latest dependencies
update_namespace_description(pkg = ".")
update_namespace_description(pkg = ".")
pkg |
Package directory |
Abhijeet Mishra
## Not run: update_namespace_description() ## End(Not run)
## Not run: update_namespace_description() ## End(Not run)