将数据加载到R并收到错误消息

时间:2018-04-21 12:27:13

标签: r

我刚尝试将数据加载到R中并收到此消息

> my_data<-read.table(file=file.choose(),header=T,sep="\t")


Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 1 did not have 2 elements
In addition: Warning messages:
1: In read.table(file = file.choose(), header = T, sep = "\t") :
  line 1 appears to contain embedded nulls
2: In read.table(file = file.choose(), header = T, sep = "\t") :
  line 4 appears to contain embedded nulls
3: In read.table(file = file.choose(), header = T, sep = "\t") :
  line 5 appears to contain embedded nulls
4: In read.table(file = file.choose(), header = T, sep = "\t") :
  line 1 appears to contain embedded nulls

完全混淆,有什么帮助吗?这是我的数据enter image description here

1 个答案:

答案 0 :(得分:0)

library(readxl)

my_data <- read_excel(path = 'pathToYourFile')

那就是它。