everytime i try to read in data i get the following error: Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 3 did not have 5 elements it was my understanding it wasn''t necessary to specifiy all defaults. The bizarre thing is this error comes from using read.table. When I use scan I get the following error: Error in scan("tree.dat") : "scan" expected a real, got "<!DOCTYPE" I have checked my work directory and the file i'',m trying to read is there. Any ideas? Thanks in advance Nirvan --------------------------------- [[alternate HTML version deleted]]
On Fri, 14 Mar 2003, Nirvan Sunderam wrote:> > everytime i try to read in data i get the following error: > > Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : > line 3 did not have 5 elements > > > it was my understanding it wasn't necessary to specifiy all defaults. The bizarre thing is this error comes from using read.table.> When I use scan I get the following error: > > Error in scan("tree.dat") : "scan" expected a real, got "<!DOCTYPE"You appear to be trying to read an HTML (or perhaps XML or SGML) file. That's unlikely to be in any of the formats R can read. Have you downloaded this from the web and saved in the wrong format? -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hi! 'The bizarre thing is this error comes from using read.table' Not bizarre, read.table is a R-function built with the R-function scan (you can look the code simply by command read.table at the R-prompt). 'Error in scan("tree.dat") : "scan" expected a real, got "<!DOCTYPE"' Obviously read.table is not able to read every data file (please look at the help for read.table and at doc/Manual/R-data.pdf). "DOCTYPE" is something by MS-Word file, instead to make use of scan (more fast) or read.table you need a flat ASCII file (i.e., trivial, you make a data sheet with some spreadsheet, Excell, and save it as separeted by tab .txt) A.S. ---------------------------- Alessandro Semeria Models and Simulations Laboratory The Environment Research Center - Montecatini (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: asemeria at cramont.it