[R] "unexpected numeric constant" while reading tab delimited csv file

Duncan Murdoch murdoch.duncan at gmail.com
Mon Nov 22 12:38:52 CET 2010


madr wrote:
> my csv file is very simple - just one line for purpose of this test:
> 0{TAB}0
> 
> and read function is this:
> csvdata = read.csv(file="d:/s/test.csv",head=FALSE,sep="\t")
> 
> then error comes:
> 
> Error in source("d:/test.csv") : 
>   d:/test.csv:1:9: unexpected numeric constant
> 1: 0       0
> 
> 
> but when I change delimiter to ; (colon) then error not shows up anymore

You used source, not read.csv.  They aren't the same thing.

If you typed what you said you typed, then you've hidden the real 
read.csv function behind your own, and your own calls source.  But I 
don't think you typed what you said you typed.

Duncan Murdoch



More information about the R-help mailing list