R/reportVegfruitShare.R

Defines functions reportVegfruitShare

Documented in reportVegfruitShare

#' @title reportVegfruitShare
#' @description reports the share of livestock products (including fish) in total calorie food supply
#' 
#' @export
#'
#' @param gdx GDX file
#' @return per-capita calories as MAgPIE object (kcal/cap/day)
#' @author Benjamin Leon Bodirsky
#' @examples
#' 
#'   \dontrun{
#'     x <- reportLivestockShare(gdx)
#'   }
#' 

reportVegfruitShare<-function(gdx){
  out<-Kcal(gdx,level = "regglo",products = "kall",product_aggr = FALSE)
  l = dimSums(out[,,"others"],dim=3.1)
  weight = dimSums(out,dim=3.1) 
  out<-l/weight
  getNames(out) <- "Nutrition|Dietary Composition|Vegetables Fruits Nuts Share (kcal/kcal)"
  
  return(out)
}
pik-piam/magpie4 documentation built on April 17, 2024, 9:22 a.m.