R/csv_clean_interp.R

#' Cleans UN WPP interpolated to single age group data then subsets to desired ISO's
#' @param countryiso This is a vector of the ISO codes for all countries you want to generate populations for.
#' @examples
#' csv_clean("AGO")
#' @keywords internal

csv_clean<-function(countryiso){
  
  #This data is provided internally by the package
  wpp_int<-global_annual_age
  
  #Create ISO for countries and subset to country
  ISOsubset<-iso_translate$ISO_num[which(as.character(iso_translate$ISO_3) %in% countryiso)]
  wppISO<-wpp_int[which(wpp_int$LocID %in% ISOsubset),]
  wppISO$ISO<-sapply(1:length(wppISO$LocID),  function(x){
    iso_translate$ISO_3[which(iso_translate$ISO_num %in% wppISO$LocID[x])]
  })
  
  wppISO<-wppISO[,-which(names(wppISO) %in% "Pop80_100")]
  
  wppISO

}
arranhamlet/popvac_package documentation built on May 10, 2019, 1:48 p.m.