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

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon Nov 22 10:57:54 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 seem to be referencing two different files somehow... one in the 
root directory of your drive D, and the other in a subdirectory D:/s. 
This may have something to do with it... or may be extraneous.

You haven't indicated what your working environment is, though the OS 
seems likely to be some variant of Windows. In your other email, you 
mention a distinction between whatever this environment is (RGui?) and 
"console". Are you using Cygwin? could end-of-line termination (CRLF vs 
LF) be causing you difficulty?

Perhaps you should follow the posting guide instructions...



More information about the R-help mailing list