Hi! For the year 2005, the function process_sinasc return an error:
df <- process_sinasc(raw_data_2005, municipality_data = TRUE)
Error in dplyr::left_join():
! Can't join x$CODOCUPMAE with y$CODOCUPMAE due to incompatible types.
ℹ x$CODOCUPMAE is a .
ℹ y$CODOCUPMAE is a .
Run rlang::last_trace() to see where the error occurred.
Hi! For the year 2005, the function process_sinasc return an error:
Backtrace: ▆
I believe the problem is process_sinasc.R in this section (lines 102-117):
if ("CODOCUPMAE" %in% variables_names) { if (!("DTNASC" %in% variables_names)) stop("The variable DTNASC is needed to preprocess the variable CODOCUPMAE") colnames(tabOcupacao)[1] <- "CODOCUPMAE" tabOcupacao$CODOCUPMAE = as.character(tabOcupacao$CODOCUPMAE) # add-nat colnames(tabCBO)[1] <- "CODOCUPMAE" tabCBO$CODOCUPMAE = as.character(tabCBO$CODOCUPMAE) ## add - nat ano <- lubridate::year(data$DTNASC) data$CODOCUPMAE <- factor(ifelse( ano <= 2005, dplyr::left_join(data, tabOcupacao, by = "CODOCUPMAE")$nome, dplyr::left_join(data, tabCBO, by = "CODOCUPMAE")$nome )) }
Here: colnames(tabOcupacao)[1] <- "CODOCUPMAE" colnames(tabCBO)[1] <- "CODOCUPMAE"
The type of one column is integer and the other is a character. I`ll suggest a pull request to fix for this (converting both columns to character).
thanks!