M. Dhaouadi
M. Dhaouadi

Reputation: 625

ERREUR : <text> in R

I'm trying to import data into R. When I submit

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

it works, but when I added row.names = 1 and I submit

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

I get ERREUR:<text>

Upvotes: 0

Views: 91

Answers (1)

Antoine Pissoort
Antoine Pissoort

Reputation: 347

If your first instance works, perhaps the easiest way would be simply to :

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

And you should have the solution with the first column of Data.txt being the row names of Dataset

Upvotes: 2

Related Questions