gpt4 book ai didi

r - 如何导入 .tsv 文件

转载 作者:行者123 更新时间:2023-12-03 13:19:57 26 4
gpt4 key购买 nike

我需要阅读一个表格,它是 .tsv R 中的文件。

enter image description here

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'

我应该怎么读?

最佳答案

这应该这样做:

read.table(file = 'drug_info.tsv', sep = '\t', header = TRUE)

关于r - 如何导入 .tsv 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33322248/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com