When you read the data back in, you can declare the data class to prevent the id being converted to a number.
DF <- data.frame(Code = c("987654321987654321","87654321087654321"), Value = 1:2)
DF
Code Value
1 987654321987654321 1
2 87654321087654321 2
write.csv(DF, "NumTest.csv", row.names = FALSE)
read.csv("NumTest.csv") #converts to numeric
Code Value
1 9.876543e+17 1
2 8.765432e+16 2
read.csv("NumTest.csv", colClasses = c("character", "numeric")) #preserves character
Code Value
1 987654321987654321 1
2 87654321087654321 2
readr::read_csv("NumTest.csv", col_types = "cn") #preserves character with shorthand notation in readr::read_csv
# A tibble: 2 × 2
Code Value
<chr> <dbl>
1 987654321987654321 1
2 87654321087654321 2