#' Makes P_tot_2d from pop3d.
#'
#' @param pop3d The 3 dimensional dataframe of population.
#'
#' @examples
#' get_P_tot_2d(pop3d)
#' @keywords internal
get_P_tot_2d= function(pop3d){
dn1 = dimnames(pop3d)[[1]]
dn2 = dimnames(pop3d)[[2]]
P_tot_2d = rep(NA, length(dn1)*length(dn2) )
dim(P_tot_2d)=c(length(dn1),length(dn2) )
for (adm in 1:length(dn1)){
for (year in 1:length(dn2) ){
P_tot_2d[adm,year] = sum(pop3d[adm,year,], na.rm=T)
}
}
rownames(P_tot_2d)=dn1
colnames(P_tot_2d)=dn2
return(P_tot_2d)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.