R/convertWHO.R

Defines functions convertWHO

Documented in convertWHO

#' @title convertWHO
#' @description Converts data from the WHO
#' @param x unconverted magpie object from read-script
#'
#' @return magpie object with a completed dataset.
#'
#' @seealso
#' [convertWHO()]


convertWHO <- function(x) {
  meanactivity <- dimSums(x, dim = 1) / nregions(x)
  x <- toolCountryFill(x, fill = NA)
  countries <- where(is.na(x))$true$regions
  x[countries, , ] <- meanactivity
  vcat(1, "better replace using function")
  return(x)
}
pik-piam/mrcommons documentation built on Dec. 8, 2024, 7:23 a.m.