R/csv2pl_vacc.R

#' Proccesses the csv created by the function format_csv and outputs population level vaccination data for included countries.
#' 
#' @param campaigncsv The csv file containing the vaccination campaigns produced by the function format_csv.
#' @param popdf The csv file generated by the function \code{\link{csv_to_adm2pop}}
#' @param epi This is a csv containing the routine infant immunization coverage for all the countries you want to generate population vaccination coverage for.
#' @param countryiso This is a vector of the ISO codes for all countries you want to generate population vaccination coverage for.
#' @param shplist This is a list of second administrative division shapefiles containing each of the GADM versions you have used to input campaigns in the input csv. Uses a standardised input, for example - "list("shp2_v2.0"=shp2_v1.0,"shp2_v2.8"=shp2_v2.8)" would be used when your input csv contains GADM2 and GADM2.8 encoding. If your csv only contains a single encoding it would be - "list("shp2_v2.0"=shp2_v1.0)
#' @param adm.setting This determines at what level the information is output. Accepts any combination of adm0 (country level), adm1 and adm2 as an input.
#' @param format This changes the format of the output. Accepts "csv" or "rdata".
#' @param savemodifier This adds a user generated string to the end of the name of the produced outputs.
#' @param rdata.output This determines whether or not to output a rdata file of the results. Accepts T or F.
#' @param scenario This changes the underlying assumptions of the population size. Base does nothing, "hiCov" reduces the population by 25 percent, "loCov" increases the population by 25 percent.
#' @param GAVI.switch This implements different vaccination campaigns based on the column "scenario" in the campaigncsv parameter. "-all.epi" ignores the contribution of epi, "5year.mass" implements five year mass vaccination campaigns,"epi90" does...something?,"+fut.epi" includes future epi coverage.
#' @param skew This affects how vaccination campaigns are applied. If the skew is set to -1 then campaigns are applied to the whole population, regardless of prior vaccination status. If the skew is set to 0 then campaigns are applied only to the unvaccinated population. Finally, if the skew is set to 1 then the campaigns are applied to the same population as susbsequent campaigns.
#' @examples
#' csv2pl_vacc(needs updating)
#' @export


csv2pl_vacc<-function(campaigncsv,popdf,epi,countryiso,shplist,
                      adm.setting="adm2",format="csv",savemodifier=NA,
                      rdata.output=F,scenario="base",GAVI.switch="base",
                      skew=0){
  time1<-Sys.time()
  print("Generating population and vaccination dataframes.")
  genvals<-popandvac(epi,popdf,countryiso,shplist,scenario,GAVI.switch,skew)
  time2<-Sys.time()
  print("Processing the vaccination campaigns.")
  cleanedschedule<-GADMagreeer(campaigncsv,scenario,GAVI.switch,skew,genvals,countryiso)
  time3<-Sys.time()
  print("Generating population level vaccination coverage from vaccination campaigns.")
  popvac<-vacgen(cleanedschedule,skew,genvals,countryiso)
  time4<-Sys.time()
  print("Outputing results.")
  outputer(popvac,adm.setting,format,rdata.output,savemodifier,genvals,popdf)
  
  print("Done!")
  
}
  
arranhamlet/popvac_package documentation built on May 10, 2019, 1:48 p.m.