Invalid multibyte string in read.csv

Encoding sets the encoding of a character string. It doesn’t set the encoding of the file represented by the character string, which is what you want. This worked for me, after trying “UTF-8″: x <- read.csv(url, header=FALSE, stringsAsFactors=FALSE, fileEncoding=”latin1”) And you may want to skip the first 16 lines, and read in the headers separately. … Read more

Specify custom Date format for colClasses argument in read.table/read.csv

You can write your own function that accepts a string and converts it to a Date using the format you want, then use the setAs to set it as an as method. Then you can use your function as part of the colClasses. Try: setAs(“character”,”myDate”, function(from) as.Date(from, format=”%d/%m/%Y”) ) tmp <- c(“1, 15/08/2008”, “2, 23/05/2010”) … Read more