[R] Error: unexpected symbol in [with read.table]

Kate Ignatius kate.ignatius at gmail.com
Fri Jun 26 19:32:30 CEST 2015


When reading in a tab delimited file using args I keep getting the error:

Error: unexpected symbol in "Name index"

Execution halted

The code is this:

a <- read.table(args[1],sep="\t",header=T, stringsAsFactors=F)

When inputting the file directly, as follows, this produces no errors:

a <- read.table("/path/to/file/filename.txt", header=T,sep="\t",
stringsAsFactors=F).

The file is such:

Name               index
Bob                  1
George             2
Dave                3
Eric                  4
.
.
.
.
Andrew            20

Is there anything I should be looking out for that might be producing
this error.   Any help will be greatly appreciated.



More information about the R-help mailing list