R 导入带有选项卡的大型数据集

R 导入带有选项卡的大型数据集,r,fread,read.table,R,Fread,Read.table,导入大型数据集(50GB)时,如果数据中出现“中断”,则会出现重大问题。我将数据拉入文本编辑器,可以看到问题出现在某个列中,其中文本溢出了几行。8列数据框的简要示例如下: 1001;;x;t;Buy;A great blue car;200;h 1002;;x;t;Buy;A great red car;300;u 1003;;x;t;Buy;A great yellow car;800;u 1004;;x;t;Buy;A great white car with more text and

导入大型数据集(50GB)时,如果数据中出现“中断”,则会出现重大问题。我将数据拉入文本编辑器,可以看到问题出现在某个列中,其中文本溢出了几行。8列数据框的简要示例如下:

1001;;x;t;Buy;A great blue car;200;h
1002;;x;t;Buy;A great red car;300;u
1003;;x;t;Buy;A great yellow car;800;u
1004;;x;t;Buy;A great white
car with more text

and more text;200;h
1005;;x;t;Buy;A great yellow car;800;u
1001;;x;t;Buy;A great blue car;200;h
1002;;x;t;Buy;A great red car;300;u
1003;;x;t;Buy;A great yellow car;800;u
1004;;x;t;Buy;A great whitecar with more textand more text;200;h
1005;;x;t;Buy;A great yellow car;800;u
我想做的是将数据合并到一个8列的框架中,以允许使用fread将数据正确地读入R。正确的解决方案如下所示:

1001;;x;t;Buy;A great blue car;200;h
1002;;x;t;Buy;A great red car;300;u
1003;;x;t;Buy;A great yellow car;800;u
1004;;x;t;Buy;A great white
car with more text

and more text;200;h
1005;;x;t;Buy;A great yellow car;800;u
1001;;x;t;Buy;A great blue car;200;h
1002;;x;t;Buy;A great red car;300;u
1003;;x;t;Buy;A great yellow car;800;u
1004;;x;t;Buy;A great whitecar with more textand more text;200;h
1005;;x;t;Buy;A great yellow car;800;u

在尝试导入之前编辑数据可能最简单,例如,如果无法编辑数据,请查看
fread
文档。您可以使用
sep
sep2
colClasses
quote
以您想要的方式读取列中的R(引号和前后斜杠可能会干扰数据的读取)。提供
nrows
参数将强制R读入超过几行的数据(有时会发生)。