[R] error with scan

Kevin Bartz bartzk at yahoo-inc.com
Tue Jul 26 21:35:59 CEST 2005


Can you show us the first line of the file?

The error means that in one of the values you specified as numeric (first, second, third, fourth, fifth, seventh, eighth, ninth), it found the character value it displayed.

Otherwise, this looks like a good use of scan.

Kevin

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jean-Pierre Gattuso
Sent: Tuesday, July 26, 2005 11:52 AM
To: r-help at stat.math.ethz.ch
Cc: Jean-Pierre Gattuso
Subject: [R] error with scan

Hi:

I am trying to read a large (500000+ lines) with scan() as read.table  
is unable to read it.

I get a strange error (below) which says that 'a real' was expected  
and '5' was read. Can someone help?

Thanks,
jp

 > type=list(a=0,b=0,c=0,d=0,e=0,f="",g=0,h=0,i=0)
 > tmp2 <- scan(file="tmp2.txt", what=type, sep=",", quote="\"",  
dec=".", skip=1, nmax=541502)
Erreur dans scan(file = "tmp2.txt", what = type, sep = ",", quote =  
"\"",  :
     scan() attendait 'a real' et a reçu '5
'

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list