#' Builds a synthetic variable for education attainment - 2010
#' @param data.frame
#' @value data.frame
#' @export
build_migration_bornSameMunicipality_2000 <- function(CensusData){
if(!is.data.frame(CensusData)){
stop("'CensusData' is not a data.frame")
}
if(!is.data.table(CensusData)){
CensusData = as.data.table(CensusData)
}
check_vars <- harmonizeIBGE:::check_var_existence(CensusData, c("v0417"))
if(length(check_vars) > 0){
stop("The following variables are missing from the data: ",
paste(check_vars, collapse = ", "))
}
# For persons who were born in the same municipality
CensusData[ , bornSameMunicipality := ifelse(v0417 == 1, 1, 0)]
gc()
CensusData
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.