I have a series of CSV files where numbers are formatted in the european style using commas instead of decimal points, i.e. 0,5
instead of 0.5
.
There are too many of these files to edit them before importing to R. I was hoping there is an easy parameter for the read.csv()
function, or a method to apply to the extracted dataset in order for R to treat the data as a number rather than a string.
When you check ?read.table
you will probably find all the answer that you need.
There are two issues with (continental) European csv files:
c
in csv stand for? For standard csv this is a ,
, for European csv this is a ;
sep
is the corresponding argument in read.table
.
, for European csv this is a ,
dec
is the corresponding argument in read.table
To read standard csv use read.csv
, to read European csv use read.csv2
. These two functions are just wrappers to read.table
that set the appropriate arguments.
If your file does not follow either of these standards set the arguments manually.