Package 'GFSir'

Title: Global Food Security analysis using IMPACT model and R
Description: Global Food Security analysis using IMPACT model and R.
Authors: Abhijeet Mishra [aut, cre]
Maintainer: Abhijeet Mishra <[email protected]>
License: GPL (>= 3)
Version: 2.5.0
Built: 2024-11-07 05:28:51 UTC
Source: https://github.com/IFPRI/GFSir

Help Index


add_crops

Description

add_crops

Usage

add_crops(df)

Arguments

df

dataframe with "j" or "c" column

Value

Cleaned scenario name

Author(s)

Abhijeet Mishra

Examples

## Not run: 
add_crops()

## End(Not run)

add_regions

Description

add_regions

Usage

add_regions(df, mapping = "mapping.xlsx")

Arguments

df

dataframe with "cty" column

mapping

Mapping file for regions

Value

Cleaned scenario name

Author(s)

Abhijeet Mishra

Examples

## Not run: 
add_regions()

## End(Not run)

clean_filename

Description

clean_filename

Usage

clean_filename(gdx)

Arguments

gdx

GDX file for IMPACT run

Value

Cleaned scenario name

Author(s)

Abhijeet Mishra

Examples

## Not run: 
clean_filename()

## End(Not run)

create_identifier_columns

Description

create_identifier_columns

Usage

create_identifier_columns(
  df,
  col = "scenario",
  into = c("SSP", "GCM", "RCP", "CO2"),
  sep = "-",
  remove = TRUE
)

Arguments

df

Dataframe where identifier columns need to be created

col

Columns which are "ID" and need to be separated

into

String vector with names of new columns

sep

Separator where "col" columns should be snipped for new columns.

remove

If "col" vector should be kicked out when making new columns.

Value

Cleaned scenario name

Author(s)

Abhijeet Mishra

Examples

## Not run: 
create_identifier_columns()

## End(Not run)

getMapping

Description

getMapping

Usage

getMapping(type = "region", file = "mapping.xlsx")

Arguments

type

"region" or "crops". Region returns six CGIAR regions + developed or developing countries + world. Crops returns IMPACT mapping for crops in their more user friendly name.

file

mapping file name

Value

mapping according to the type selected

Author(s)

Abhijeet Mishra

Examples

## Not run: 
getMapping()

## End(Not run)

Results for population and GDP

Description

Results for population and GDP

Usage

group1(gdx, mapping = "mapping.xlsx")

Arguments

gdx

GDX of an IMPACT run

mapping

mapping file name

Value

dataframe results for population and GDP

Author(s)

Abhijeet Mishra

Examples

## Not run: 
group1()

## End(Not run)

Group 3 data processing (Area, yields, production, prices, net trade, demand)

Description

Group 3 data processing (Area, yields, production, prices, net trade, demand)

Usage

group3(gdx, indicator = "population", mapping = "mapping.xlsx")

Arguments

gdx

GDX of an IMPACT run

indicator

Which indicator to return in aggregated format. Defaults to "population". Available settings are "area", "production", "yield", "prices", "trade", "demand", "population", "perCapDemand", "bluewater" and "greenwater"

mapping

mapping file name

Value

dataframe results for Area, yields, production, prices, net trade, demand

Author(s)

Abhijeet Mishra

Examples

## Not run: 
group3()

## End(Not run)

Results for per capital kcal availability

Description

Results for per capital kcal availability

Usage

group4(gdx, mapping = "mapping.xlsx")

Arguments

gdx

GDX of an IMPACT run

mapping

mapping file name

Value

dataframe results for per capital kcal availability

Author(s)

Abhijeet Mishra

Examples

## Not run: 
group4()

## End(Not run)

Results for population at risk of hunger

Description

Results for population at risk of hunger

Usage

group5(gdx, mapping = "mapping.xlsx")

Arguments

gdx

GDX of an IMPACT run

mapping

Mapping file for regions

Value

Results for population at risk of hunger

Author(s)

Abhijeet Mishra

Examples

## Not run: 
group5()

## End(Not run)

save_ggplot

Description

save_ggplot

Usage

save_ggplot(
  p,
  dest = tempdir(),
  plot_name = "dummy",
  ext = "png",
  units = "in",
  width = 7,
  height = 7,
  dpi = 300
)

Arguments

p

"plot" to be saved. Has to be a ggplot object

dest

Destination directory of the plot

plot_name

Name of the plot to be exported

ext

Extension for saving the plot. e.g "png" or "eps" etc.

units, width, height

Plot size in units ("in", "cm", "mm", or "px"). If not supplied, uses the size of current graphics device.

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types

Value

NULL. The function only saves a ggplot object

Author(s)

Abhijeet Mishra

Examples

## Not run: 
save_ggplot()

## End(Not run)