[datatable-help] Reading corrupt csv and replace wrong value

DanMik dan at dd-software.dk
Thu Jun 16 23:40:52 CEST 2011


Im fairly new to R.

I have a huge csv file, of 400.000+ K, and now it looks like one of the
values is corrupt. (it contains a ?, so one value becomes:
"0,0742076391?39524")
Because of the size i can't edit it in a text editor, and the file took
several days to create (many calculations)

When i read the file it cant be converted to numbers because of this one
value which i found with scan() and have found the coordinates of.

I'm reading the file with:

x <- read.csv2("filename.csv", stringsAsFactor= FALSE)

Can i read the file with everything as numeric, and replace non numeric
values with 0 ?

or somehow correct this one value?

I have tried first reading the file, then set the value to 0 and then use
as.matrix and afterwards as.numeric. This just creates a lot of NA 

--
View this message in context: http://r.789695.n4.nabble.com/Reading-corrupt-csv-and-replace-wrong-value-tp3603848p3603848.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list