Questions tagged «read.table»

8
read.csv警告“带引号的字符串内的EOF”会阻止文件的完全读取
我有一个CSV文件(24.1 MB),无法完全读入R会话。当我在电子表格程序中打开文件时,我可以看到112,544行。当我用R将其读入R时,read.csv只会得到56,952行和以下警告: cit <- read.csv("citations.CSV", row.names = NULL, comment.char = "", header = TRUE, stringsAsFactors = FALSE, colClasses= "character", encoding= "utf-8") Warning message: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : EOF within quoted string 我可以使用以下命令将整个文件读入R readLines: rl <- readLines(file("citations.CSV", encoding = "utf-8")) length(rl) [1] 112545 但是我无法将其作为表格返回到R中(通过read.csv): …
125 r  csv  eof  read.table 

4
在read.table / read.csv中为colClasses参数指定自定义日期格式
题: 在read.table / read.csv中使用colClasses参数时,是否可以指定日期格式? (我知道我可以在导入后进行转换,但是使用许多这样的日期列,在导入步骤中会更容易进行) 例: 我有一个.csv,日期格式为%d/%m/%Y。 dataImport <- read.csv("data.csv", colClasses = c("factor","factor","Date")) 这使转换错误。例如,15/07/2008变为0015-07-20。 可复制的代码: data <- structure(list(func_loc = structure(c(1L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 5L), .Label = c("3076WAG0003", "3076WAG0004", "3076WAG0007", "3076WAG0009", "3076WAG0010"), class = "factor"), order_type = structure(c(3L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 3L, …
101 r  date  read.table  read.csv 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.