#' Adds the years 1940 to 1950 to the 2 dimensional dataframe of population "pop2d".
#'
#' @param pop2d The 2 dimensional dataframe of population.
#'
#' @examples
#' add_1940_1950(pop2d)
#' @keywords internal
add_1940_1950 = function(pop2d){
if(min(pop2d$year) != 1950) stop("pop2d should start in 1950")
for(y in 1949:1940) {
pop1.early<-pop2d[pop2d$year==y+1,]
pop1.early$year<-y
pop2d<-rbind(pop1.early,pop2d)
}
return(pop2d)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.