M*P 发帖数: 6456 | 1 I was reading a tab delimited file using either read.table() or read.csv().
read.table() cannot read the whole file as it claims that some row has less
elements than others, but read.csv() can read the whole table without error.
What is the difference between read.table() and read.csv()?
| l*******h 发帖数: 151 | 2 read.csv() is used to read CSV which is delimited by commas. read.table is
usually used to read raw data delimited by space. For your case, reading tab
delimited files, you can also try read.delim(..., sep="\t"). | M*P 发帖数: 6456 | 3 I used sep='\t' in both functions at the first place.
tab
【在 l*******h 的大作中提到】 : read.csv() is used to read CSV which is delimited by commas. read.table is : usually used to read raw data delimited by space. For your case, reading tab : delimited files, you can also try read.delim(..., sep="\t").
| g**a 发帖数: 2129 | 4 using the following line to read the table
read.table(,sep="\t",comment="",quote="")
Some of the values must contain "#" or "\" which caused the problem. | M*P 发帖数: 6456 | 5 You are right, there are '#' in the table.
【在 g**a 的大作中提到】 : using the following line to read the table : read.table(,sep="\t",comment="",quote="") : Some of the values must contain "#" or "\" which caused the problem.
| e*****t 发帖数: 642 | 6 use read.delim
it would be fine |
|