[R] NA rownames in dataframes
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Wed Aug 28 21:54:14 CEST 2002
It's a bug in data.frame. You should not be allowed NA rownames.
Solution: don't specify them.
I'll add a test for 1.6.0.
On Wed, 28 Aug 2002, Yi, Derek wrote:
> Hey everyone!
>
> I am seeing strange behavior with NA in the rownames of dataframes:
>
> > a <- data.frame(1:3, row.names = c("r1", NA, "r3"))
> > cbind(a)
> X1.3
> r1 1
> <NA> 2
> r3 3
>
> Everything works. The peculiar thing is that when the NA is in the first
> row, things no longer work as I would have expected:
>
> > b <- data.frame(1:3, row.names = c(NA, "r2", "r3"))
> > cbind(b)
> Error in if (missing(row.names) && (nrows[i] > 0) && (rowsi[[1]] != ""))
> row.names <- data.row.names(row.names, :
> missing value where logical needed
> > data.frame(b)
> Error in if (missing(row.names) && (nrows[i] > 0) && (rowsi[[1]] != ""))
> row.names <- data.row.names(row.names, :
> missing value where logical needed
>
> > traceback()
> 3: data.frame(..., check.names = FALSE)
> 2: cbind(...)
> 1: cbind(b)
>
> This seems to be a problem associated only with dataframes, as a similar
> example using matrices works perfectly fine. Has anyone experienced this
> behavior before?
>
> Thanks!
>
> Derek
>
> > R.version
> _
> platform sparc-sun-solaris2.6
> arch sparc
> os solaris2.6
> system sparc, solaris2.6
> status
> major 1
> minor 5.1
> year 2002
> month 06
> day 17
> language R
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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