R如何使用不同的分隔符读取.csv文件

时间:2014-04-15 14:17:59

标签: r csv separator

ItemID,Sentiment,SentimentSource,SentimentText

1,0,Sentiment140,     ok thats it you win.

2,0,Sentiment140,    i think mi bf is cheating on me!!!       T_T

3,0,Sentiment140,"    I'm completely useless rt now. Funny, all I can do is twitter. "

你如何将这样的csv文件读入R?

1 个答案:

答案 0 :(得分:0)

使用read.csv()阅读csv。您可以将sep=""指定为您需要的任何内容。但如下所述,,是分隔符的默认值。

R: Data Input

例如,csv文件用逗号作为数据帧的分隔符,手动选择文件:

df <- read.csv(file.choose())