Hello,
I have a .csv file with the zip code in the middle of the address, in square brackets. In some cases there is no zip, but there is always the [] set, possibly empty, for example:
RUA ESTEVAM DE ARAÚJO DE ALMEIDA 521 L 17 Q. 15 [23028730] GUARATIBA
I want this information in a new variable. For this, I wrote an R code to extract the zip through the grep
function, but it is generating an error:
hans$cep <- grep("\[*?\d{8}\]", hans$endereco.do.domicilio, value = T)
Error in '$<-.data.frame'('*tmp*', "cep", value = c("RUA ESTEVAM DE ARAÚJO DE ALMEIDA 521 L 17 Q. 15 [23028730] GUARATIBA", :
replacement has 59940 rows, data has 61674