#' Calculates the number of doses used from coverage.
#'
#' @param vacc.cov The vaccination coverage 3d array.
#' @param year The year the vaccination campaign took place in.
#' @param country The ISO code of the vaccination campaign took place in.
#' @param adm1 The adm1 location the vaccination campaign took place in.
#' @param adm2 The adm2 location the vaccination campaign took place in.
#' @param doses The doses used in the vaccination campaign.
#' @param coverage The coverage of the vaccination campaign took place in.
#' @param agemin The minimum age targeted.
#' @param agemax The maximum age targeted.
#' @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
#' calc.doses(vacc.cov=campaigns,year=2016,country="AGO",adm1="AGO1",adm2=NA,doses=NA,coverage=.9,agemin=10,agemax=50,skew=0)
#' @keywords internal
calc.doses = function(vacc.cov,year,country=NA,adm1=NA,adm2=NA,doses=0,coverage=NA,agemin=0,agemax=100,skew=0) {
if(!is.na(coverage)) {
if(coverage>1) coverage<-coverage/100 # re-scale from percentage to proportion
coverage<-min(coverage,1)
if(!is.na(country)[1]) { x1<-which(dn1.0 %in% country)
} else if(!is.na(adm1)[1]) { x1<-which(dn1.1 %in% adm1)
} else if(!is.na(adm2)[1]) { x1<-which(dn1.2 %in% adm2)
} else { stop("missing country/adm1/adm2 information.\n")
}
x2<-match(year+1,dn2)
x3.min<-agemin+1
x3.max<-agemax+1
tot.pop<-sum(pop1.adm2[x1,x2,x3.min:x3.max],na.rm=T)
doses<-tot.pop*coverage
}
return(doses)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.