[Rd] format() of a character matrix converts to vector (PR#960)

John.Peters@tip.csiro.au John.Peters@tip.csiro.au
Thu, 31 May 2001 09:27:58 +0200 (MET DST)


Using R 1.2.3 under both windows 95 and linux, format() works fine on a 
numerical matrix, but converts a character matrix to a vector, apparently 
omitting to convert it back to a matrix:

> a_matrix(c("axx","b","c","d","e","f","g","h"),nrow=2)

> a
     [,1]  [,2] [,3] [,4]
[1,] "axx" "c"  "e"  "g" 
[2,] "b"   "d"  "f"  "h" 
 
> format(a)
[1] "axx" "b  " "c  " "d  " "e  " "f  " "g  " "h  "

> format(a,justify="right")
[1] "axx" "  b" "  c" "  d" "  e" "  f" "  g" "  h"

> format(a,justify="left")
[1] "axx" "b  " "c  " "d  " "e  " "f  " "g  " "h  "

> format(a,justify="none")
     [,1]  [,2] [,3] [,4]
[1,] "axx" "c"  "e"  "g" 
[2,] "b"   "d"  "f"  "h" 


Many thanks

----------------------------------------------------------------------------
John Peters
CSIRO National Measurement Laboratory
PO Box 218                                Phone:    +61 2 9413 7503
Lindfield NSW 2070                        Fax:      +61 2 9413 7202
Australia                                 Internet: John.Peters@tip.CSIRO.AU
----------------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._