NB: To the best of my knowledge this question is not a duplicate! All the questios/answers I found are either how to eliminate points from data that are already in R or how to change the decimal point to a comma when loading it.
I have a csv with numbers like: 4.123,98
. The problem is that because of the .
the output becomes a character string matrix when loading with read.table
, read.csv
or read.csv2
. Changing dec
to ,
doesn't help.
My question
What is the most elegant way to load this csv so that the numbers become e.g. 4123.98
as numeric?
Rather than try to fix it all at loading time, I would load the data into R as a string, then process it to numeric.
So after loading, it's a column of strings like "4.123,98"
Then do something like: