我需要阅读的表如何在R中导入.tsv文件?
test <- read.table(file='drug_info.tsv')
# Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
# line 1 did not have 10 elements
test <- read.table(file='drug_info.tsv',)
# Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
# line 1 did not have 10 elements
scan("drug_info.tsv")
# Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
# scan() expected 'a real', got 'ChallengeName'
scan(file = "drug_info.tsv")
# Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
# scan() expected 'a real', got 'ChallengeName'
我应该如何看呢?
请复制/粘贴文件的前5行到您的问题,并删除图片。 –
使用缺省设置 – rawr
'read.table'默认使用空格分隔符(通常表示空格或制表符)。如果你有空格,你可以使用'sep =“\ t”'明确地将分隔符设置为tab。 'read.table'与有效的输入文件一起工作,所以如果在导入数据时出现问题,它与文件相关,而不是函数。因此,为了帮助您,我们需要您分享您实际尝试导入的文件样本,而不是其他程序中的数据图片。 – MrFlick