I have a "csv" text file where each field is separated by \t&%$# which I'm now trying to import into R.
The sep= argument of read.table()instists on a single character. Is there a quick way to directly import this file?
Some of the data fields are user-submitted text which contain tabs, quotes, and other messy stuff, so changing the delimiter to something simpler seems like it could create other problems.
解决方案
The following code will be able to handle multiple separator chars:
#fileName
#separators
read
data
close(con)
records
dataFrame
rownames(dataFrame)
return(as.data.frame(dataFrame,stringsAsFactors = FALSE))
}