[R] Non-alignment of <NA> in rownames

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Aug 1 18:04:47 CEST 2002


On Thu, 1 Aug 2002, Yi, Derek wrote:

> Hello everyone,
>
> Apologies in advance if you have received this multiple times!
>
> On a thread similar to that posted by Don MacQueen
> (http://www.r-project.org/nocvs/mail/r-help/2002/3455.html): is there any

That is fixed in 1.5.1, so this is clearly unrelated.

> way to nicely format NA's when listed as rownames?  When NA's are part of
> rownames, the alignment is thrown off:
>
> > z <- matrix(c(100, 200, 300))
> > z
>      [,1]
> [1,]  100
> [2,]  200
> [3,]  300
> > rownames(z) <- c("x", "y", NA)
> > z
>      [,1]
> x     100
> y     200
> <NA>    300
>
> This strikes me as strange, especially because the brackets don't affect NA
> alignment elsewhere (like as an element in a dataframe or matrix).  Any
> insights?

No one has previously reported this, and it does not occur anywhere in R
test suites (or we would have seen a difference when <NA> was introduced).
You can't have NA as a rowname for a data frame, and it seems peculiar to
have it as rowname for a matrix.

If you find a fix, please submit it to R-bugs with a bug report.

-- 
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