I've looked at other answers regarding my issue and nothing seems to help. So I hope I'm in the right to post a question similar to one that was posted some years ago.
My issue is that during read.table() all the columns come in as factors, even if some of them only contain values (and a few NA's), and, when I try to convert them using as.numeric(), the values simply change, although, indeed they turn numeric. See example.
df <- read.table(doc.csv, header = TRUE, sep = ",", dec = ".")
df$value
# Results in
[1] 2254 1873 2201 2147 2456 1785
# So..
as.numeric(df$value)
[1] 26 14 22 20 32 11
- I have made sure that the original .csv document contains only numerics and NA's.
- I have tried converting into characters first, and then numerics. Same issue.
Any ideas? I'm stumped.