Reputation: 98
I have one problem when I want to read a table from txt file in R. When I do
dat <- read.table("~/data/data.txt", quote="\""),
it is working perfectly. But, when I try to name the colums with this commands :
dat <- read.table("~/data/data.txt",quote="\"",c("com","Type","blabla","blabla"),header=TRUE).
I have this error :
Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE, : invalid 'sep' value: must be one byte)
Thanks for your help.
Upvotes: 0
Views: 644
Reputation: 489
If you want to rename the columns, just add col.names =
before your vector of names.
You therefore have something like:
dat <- read.table("~/data/data.txt", quote="\"",
col.names=c("com", "Type", "blabla", "blabla"), header=TRUE).
This might solve your problem.
Upvotes: 3