[R] problems with read.table()
Ott Toomet
siim at obs.ee
Tue Jan 22 11:06:38 CET 2002
According to the documentation, my previous try should be OK. row.names
should not change the result as the documentation says:
Otherwise if row.names is missing, the rows are numbered.
If I try to add row.names=NULL, the result is strange:
> a <- read.delim("/home/siim/tyy/kestus-MC/tab20.and", row.names=NULL)
# no error messages here but the result is not correct either:
> a
row.names t prod
1 7 0.01138 NA
2 9 0.01138 NA
3 13 0.01138 NA
You can notice, that all the columns have shifted to left -- column named
row.names should be t and t should be prod. The original file looks like
t prod
7.00000 0.0113800
9.00000 0.0113800
So I would be happy if anybody could explain me the patching.
Thanks in advance
Ott Toomet
On Tue, 22 Jan 2002, Joerg Maeder wrote:
>
> from the r-documentation
>
> on my system (sparc solaris 2.8) is no such behaviour
>
> Try row.names = NULL (forces row numbering)
>
> gruess
>
> joerg
>
> Ott Toomet wrote:
> >
> > Hi,
> >
> > I have lately migrated to R 1.4.0.
> >
> > trying to read a table into R with read.delim, I hot the following error:
> >
> > > tab20 <- read.delim("tab20.and")
> > Error in "row.names<-.data.frame"(*tmp*, value = row.names) :
> > duplicate row.names are not allowed
> >
> > The beginning of the file looks like (there are TAB-s between columns, both
> > in the header and in the datalines):
> >
> >
> > The read.delim() works fine as long I have only 51 lines of data in addition
> > to the header, but if there are 52 or more lines, the first column is read
> > in as the row.names and because some t-values coincide, it gives the error.
> >
> > I have noticed problems with read.table here in the list before, but I could
> > not figure out what is the corresponding patch, and how to find and install
> > it.
> >
> > I have RH 7.1 linux and
> >
> > platform i686-pc-linux-gnu
> > arch i686
> > os linux-gnu
> > system i686, linux-gnu
> > status
> > major 1
> > minor 4.0
> > year 2001
> > month 12
> > day 19
> > language R
> >
> > Thanks in advance,
> >
> > Ott Toomet
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list