ERREUR:R中的<text>

时间:2017-10-15 08:26:20

标签: r

我正在尝试将数据导入R. 当我提交

Dataset <- read.table("Data.txt",
       header = TRUE, sep = "\t", na.strings = "NA", dec = ".", strip.white = TRUE)

它有效,但当我添加row.names = 1并提交

 Dataset <- read.table("Data.txt",
       header = TRUE, sep = "\t", na.strings = "NA", dec = ".", row.names = 1, strip.white = TRUE)

我得到ERREUR:<text>

1 个答案:

答案 0 :(得分:2)

如果您的第一个实例有效,也许最简单的方法就是:

`Dataset <- read.table("Data.txt", header = TRUE, sep = "\t", 
                       na.strings = "NA", dec = ".", strip.white = TRUE)
rownames(Dataset) <- Dataset[, 1]
Dataset <- Dataset[, -1]`

您应该拥有Data.txt的第一列是Dataset

的行名称的解决方案