Package 'DOORMAT'

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

Help Index


Function to aggregate IMPACT results at a specified level

Description

Function to aggregate IMPACT results at a specified level

Usage

aggregateIMPACT(
  df = NULL,
  level = "regglo",
  aggr_type = "sum",
  sp_mapping = "Standard-IMPACT_dis1",
  keep_cty = FALSE
)

Arguments

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.

Value

Country or FPU level aggregation of IMPACT results

Author(s)

Abhijeet Mishra

Examples

## Not run: 
aggregateIMPACT()

## End(Not run)

Build package utility

Description

Build package utility

Usage

buildPackage(lib = ".", quiet = FALSE, ignore_lintr = FALSE)

Arguments

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

Author(s)

Abhijeet Mishra

Examples

## Not run: 
buildPackage()

## End(Not run)

Build package utility for DRAT linkage of IFPRI R packages

Description

Build package utility for DRAT linkage of IFPRI R packages

Usage

drat_source_build(lib = ".")

Arguments

lib

Path to library

Author(s)

Abhijeet Mishra

Examples

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

Description

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.

Usage

findMapping(name = NULL, file = "default_mappings.xlsx", multimap = FALSE, ...)

Arguments

name

Name of mapping to get. You can provide any name here but the options when using default mapping are

  • "c" –> Crops

  • "j" –> Activities

  • "cty" –> Countries with 6 CGIAR region mappings

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.

Author(s)

Abhijeet Mishra

Examples

## Not run: 
getMapping(name = "c")

## End(Not run)

R utility package for reading objects from a GDX file.

Description

R utility package for reading objects from a GDX file.

Usage

readGDX(
  gdx,
  name,
  use_model_name = "IMPACT",
  verbosity = FALSE,
  quick_df = FALSE
)

Arguments

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

Value

Parameter and domain of gdx output result queried

Author(s)

Abhijeet Mishra

Examples

## Not run: 
readGDX()

## End(Not run)

Function which pulls the domain list

Description

Function which pulls the domain list

Usage

tool_get_domain_mapping(domain = NULL, file = "mapping_items.xlsx")

Arguments

domain

set

file

Mapping file

Value

Mapping object for IMPACT framework

Author(s)

Abhijeet Mishra

Examples

## Not run: 
tool_get_mapping()

## End(Not run)

Function for getting correct mapping of IFPRI regions (CTY to regions)

Description

Function for getting correct mapping of IFPRI regions (CTY to regions)

Usage

tool_get_mapping(
  type = NULL,
  file = "mapping_items.xlsx",
  sheet = NULL,
  sp_mapping = "Standard-IMPACT_dis1"
)

Arguments

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

Value

Mapping object for IMPACT framework

Author(s)

Abhijeet Mishra

Examples

## Not run: 
tool_get_mapping()

## End(Not run)

Simple update for latest dependencies

Description

Simple update for latest dependencies

Usage

update_namespace_description(pkg = ".")

Arguments

pkg

Package directory

Author(s)

Abhijeet Mishra

Examples

## Not run: 
update_namespace_description()

## End(Not run)