简体   繁体   中英

R how to read a .csv file with different separators

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. "

How would you read a csv file like this into R?

Read a csv with read.csv() . You can specify sep="" to be whatever you need it to be. But as noted below, , is the default value for the separator.

R: Data Input

For example, csv file with comma as separator to a dataframe, manually choosing the file:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM