read.csv

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

删除回忆录丶 提交于 2019-11-26 00:31:52
问题 Question: Is there a way to specify the Date format when using the colClasses argument in read.table/read.csv? (I realise I can convert after importing, but with many date columns like this, it would be easier to do it in the import step) Example: I have a .csv with date columns in the format %d/%m/%Y . dataImport <- read.csv(\"data.csv\", colClasses = c(\"factor\",\"factor\",\"Date\")) This gets the conversion wrong. For example, 15/07/2008 becomes 0015-07-20 . Reproducible code: data <-