无法使用sep =“,;在r
我正在尝试阅读R中的一个庞大的CSV文件(约35 GB)
。
现在,在CSV文件中,所有变量和观测值都被“,”分开。添加一个快照。
如果我适用于类似的数据,
df = rbind("varA,varB,varC","Id1,0,23","Id2,1,34","Id3,2,145")
write.table(df,file="data1.csv",row.names = FALSE,col.names = FALSE)
huge_file <- 'data1.csv'
#First detect a data model for your file:
model <- detect_dm_csv(huge_file,header=TRUE,sep=",",fill=TRUE) #1
#model
df.laf <- laf_open(model)
df_read
# varA.varB.varC
#1 Id1,0,23
#2 Id2,1,34
#3 Id3,2,145
我将无法弄清楚如何将变量和观测值分开。 任何帮助都非常感谢。
I am trying to read a huge CSV file(about 35 GB) in R.
I am using LaF
package for this.
Now in the csv files, all the variables and observations are separated by ",". Adding a snap of this.
If I am apply to a similar looking data
df = rbind("varA,varB,varC","Id1,0,23","Id2,1,34","Id3,2,145")
write.table(df,file="data1.csv",row.names = FALSE,col.names = FALSE)
huge_file <- 'data1.csv'
#First detect a data model for your file:
model <- detect_dm_csv(huge_file,header=TRUE,sep=",",fill=TRUE) #1
#model
df.laf <- laf_open(model)
df_read
# varA.varB.varC
#1 Id1,0,23
#2 Id2,1,34
#3 Id3,2,145
I can't figure out how to separate the variables and the observations.
Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
多亏了@gregor Thomas的评论,
sep =“ \ t”
可以用来将数据分开为不同的列。我希望以下方式可以是阅读data1.csv
的可能有效方法之一:Thanks to @Gregor Thomas' comment,
sep = "\t"
can be used to separate the data into different columns. I hope the following way can be one of possibly efficient ways to readdata1.csv
: