[R] problem with read.table()

Birgitle birgit.lemcke at systbot.uzh.ch
Wed Jul 30 11:24:17 CEST 2008


Hello R-User

I have a table as tab-delimited textfile (291 rows, 83 columns).
The first row are labels and the first line the variable names.

I used the following code several times with different similar tables and it
always worked.
But now:

   setClass("of")
   setAs("character", "of", function(from) as.ordered(from))

  Classe82<-cclasses <- c(rep("factor", 63),  rep("numeric",7), rep ("of",
12))
  Table<-read.table("Table.txt",header=TRUE,row.names=1, na.strings="NA"
,colClasses = Classe82)

I get this error-message:

  Fehler in scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings,  : 
  scan() erwartete 'a real', bekam '8,5'

  Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  scan()  expected 'a real', got '8,5'

It seems that the error is in the colClasses-argument. Without this argument
it reads the table.
I checked allready if there are empty cells or blanks in the header but
could not find.
Maybe that its just a simple thing and I know that I can change the classes
after reading in the table, but I really would like to know how to do this
right.

I would be very glad if somebody has an idea, or could tell me, how I could
find out, what`s going wrong.

Many thanks in advance

B.

-----
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
-- 
View this message in context: http://www.nabble.com/problem-with-read.table%28%29-tp18729348p18729348.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list