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 |
add_crops
add_crops(df)
add_crops(df)
df |
dataframe with "j" or "c" column |
Cleaned scenario name
Abhijeet Mishra
## Not run: add_crops() ## End(Not run)
## Not run: add_crops() ## End(Not run)
add_regions
add_regions(df, mapping = "mapping.xlsx")
add_regions(df, mapping = "mapping.xlsx")
df |
dataframe with "cty" column |
mapping |
Mapping file for regions |
Cleaned scenario name
Abhijeet Mishra
## Not run: add_regions() ## End(Not run)
## Not run: add_regions() ## End(Not run)
clean_filename
clean_filename(gdx)
clean_filename(gdx)
gdx |
GDX file for IMPACT run |
Cleaned scenario name
Abhijeet Mishra
## Not run: clean_filename() ## End(Not run)
## Not run: clean_filename() ## End(Not run)
create_identifier_columns
create_identifier_columns( df, col = "scenario", into = c("SSP", "GCM", "RCP", "CO2"), sep = "-", remove = TRUE )
create_identifier_columns( df, col = "scenario", into = c("SSP", "GCM", "RCP", "CO2"), sep = "-", remove = TRUE )
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. |
Cleaned scenario name
Abhijeet Mishra
## Not run: create_identifier_columns() ## End(Not run)
## Not run: create_identifier_columns() ## End(Not run)
getMapping
getMapping(type = "region", file = "mapping.xlsx")
getMapping(type = "region", file = "mapping.xlsx")
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 |
mapping according to the type selected
Abhijeet Mishra
## Not run: getMapping() ## End(Not run)
## Not run: getMapping() ## End(Not run)
Results for population and GDP
group1(gdx, mapping = "mapping.xlsx")
group1(gdx, mapping = "mapping.xlsx")
gdx |
GDX of an IMPACT run |
mapping |
mapping file name |
dataframe results for population and GDP
Abhijeet Mishra
## Not run: group1() ## End(Not run)
## Not run: group1() ## End(Not run)
Group 3 data processing (Area, yields, production, prices, net trade, demand)
group3(gdx, indicator = "population", mapping = "mapping.xlsx")
group3(gdx, indicator = "population", mapping = "mapping.xlsx")
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 |
dataframe results for Area, yields, production, prices, net trade, demand
Abhijeet Mishra
## Not run: group3() ## End(Not run)
## Not run: group3() ## End(Not run)
Results for per capital kcal availability
group4(gdx, mapping = "mapping.xlsx")
group4(gdx, mapping = "mapping.xlsx")
gdx |
GDX of an IMPACT run |
mapping |
mapping file name |
dataframe results for per capital kcal availability
Abhijeet Mishra
## Not run: group4() ## End(Not run)
## Not run: group4() ## End(Not run)
Results for population at risk of hunger
group5(gdx, mapping = "mapping.xlsx")
group5(gdx, mapping = "mapping.xlsx")
gdx |
GDX of an IMPACT run |
mapping |
Mapping file for regions |
Results for population at risk of hunger
Abhijeet Mishra
## Not run: group5() ## End(Not run)
## Not run: group5() ## End(Not run)
save_ggplot
save_ggplot( p, dest = tempdir(), plot_name = "dummy", ext = "png", units = "in", width = 7, height = 7, dpi = 300 )
save_ggplot( p, dest = tempdir(), plot_name = "dummy", ext = "png", units = "in", width = 7, height = 7, dpi = 300 )
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 |
NULL. The function only saves a ggplot object
Abhijeet Mishra
## Not run: save_ggplot() ## End(Not run)
## Not run: save_ggplot() ## End(Not run)