导入许多csv文件时出现多字节错误

时间:2014-01-18 04:28:58

标签: r csv import multibyte

Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) : 
  invalid multibyte string at '<a7><8a>w<4f>'<86>u3<cc>V'<c6>70?<f2><83><f5><9f><8f><f6>yUe]m   ])TQ<95><94><9d><bb><d9>h<c3><fa>EQ<b4><ae><8a>'

尝试导入包含大约1100个cdv文件的目录时出现上述错误。我必须在某个文件中有一个符号,但我不知道如何找到导致问题的文件

我使用以下代码导入:

   file_list <- list.files("directory")
   dataset<- ldply(file_list, read.csv, header=FALSE,
   comment.char="",fill=TRUE,blank.lines.skip=TRUE,quote="")

示例文件:

 ,    11,   2905, - 2905,NE,   1595,LB, ,    11,      ,  ,    ,    0, 6:33A,01MY11,        
 ,    11,   1595, - 1620,NE, -    5,LB, ,    14,      ,  ,    ,    0, 6:36A,01MY11,        
 ,    12,   8565, - 8615,NE,   9030,LB, ,     9,      ,  ,    ,    0, 6:56A,01MY11,        
 ,    12,   5095, - 5095,NE,   3965,LB, ,     8,      ,  ,    ,    0, 6:58A,01MY11,        
 ,    12,   3840, - 3845,NE,     85,LB, ,     4,      ,  ,    ,    0, 7:02A,01MY11,        
 ,    13,   1120, - 1120,NE,  10400,LB, ,     4,      ,  ,    ,    0, 7:18A,01MY11,        
 ,    13,   4835, - 5355,NE,   5465,LB, ,     3,      ,  ,    ,    0, 7:20A,01MY11,        
 ,    13,   5180, - 5180,NE,    275,LB, ,     1,      ,  ,    ,    0, 7:23A,01MY11,        
 ,    13,     30, -   30,NE,    295,LB, ,    13,      ,  ,    ,    0, 7:25A,01MY11,        
 ,    13,    155, -  155,NE,    150,LB, ,    15,      ,  ,    ,    0, 7:26A,01MY11,        
 ,    14,   5210, - 5240,NE,  12265,LB, ,    10,      ,  ,    ,    0, 7:45A,01MY11,        
 ,    14,   4060, - 4065,NE,   8195,LB, ,     7,      ,  ,    ,    0, 7:47A,01MY11,        
 ,    14,   6440, - 6440,NE,   1760,LB, ,     6,      ,  ,    ,    0, 7:50A,01MY11,        
 ,    14,   1790, - 1745,NE,     65,LB, ,    12,      ,  ,    ,    0, 7:52A,01MY11,        
 ,    15,   2340, - 2385,NE,   7345,LB, ,    12,      ,  ,    ,    0, 8:07A,01MY11,        
 ,    15,   4835, - 4835,NE,   2565,LB, ,     5,      ,  ,    ,    0, 8:10A,01MY11,        
 ,    15,   2615, - 2225,NE, -   60,LB, ,     2,      ,  ,    ,    0, 8:12A,01MY11,  

关于如何将这样的1100个文件合并到一个数据集中的任何想法?

我正在使用OS X和R studio 0.97.551。

0 个答案:

没有答案