R/reportProductionNr.R

Defines functions reportProductionNr

Documented in reportProductionNr

#' @title reportProductionNr
#' @description reports production in Nr analoguous to reportProduction
#' 
#' @import magpiesets 
#' @export
#' 
#' @param gdx GDX file
#' @param detail if detail=FALSE, the subcategories of groups are not reported (e.g. "soybean" within "oilcrops")
#' @return production as MAgPIE object. Unit: see names
#' @author Benjamin Leon Bodirsky
#' @examples
#' 
#'   \dontrun{
#'     x <- reportProductionNr(gdx)
#'   }
#' 

reportProductionNr<-function(gdx,detail=FALSE){
  x = collapseNames(production(gdx = gdx,level="regglo",products = readGDX(gdx,"kall"),product_aggr = FALSE,water_aggr = TRUE,attributes = "nr"),collapsedim = "attributes")
  out<-reporthelper(x=x,dim=3.1,level_zero_name = "Production",detail = detail)
  getNames(out) <- paste(getNames(out),"(Mt Nr/yr)",sep=" ")
  out <- summationhelper(out)
  return(out)
}
pik-piam/magpie4 documentation built on April 17, 2024, 9:22 a.m.