I concatenated some varibales to create an ID, I created two types of variables concatenated (both with same values), one in a string format and the other in a numeric format. But the result differs in the last 2 digits, it supossed to be the same, I used the same values
id_viv <- SD %>%
mutate(id_viv =
as.numeric(paste0(cd_a, ent, con, v_sel,
n_hog, h_mud, n_ren, n_pro_viv)),
id_viv_char = (paste0(cd_a, ent, con, v_sel,
n_hog, h_mud, n_ren, n_pro_viv)))
At first, I thought those values were exactly the same and they were just different in a visual perspective. So I tried to compared both with the duplicated function but they were actually different...
first result
table(duplicated(id_viv$id_viv))
output:
FALSE TRUE
403296 356
second result
table(duplicated(id_viv$id_viv_char))
output:
FALSE TRUE
403644 8
Someone knows why this happen?
P.S: This also happens in STATA