From gregory_r_warnes at groton.pfizer.com  Tue May 20 16:41:16 2003
From: gregory_r_warnes at groton.pfizer.com (gregory_r_warnes@groton.pfizer.com)
Date: Tue May 20 15:41:28 2003
Subject: [Rd] FW: print.matrix incorrectly formatting string matrixes when
	righ (PR#3058)
Message-ID: <200305201341.h4KDfG2b024847@pubhealth.ku.dk>


> When printing a string matrix with right=TRUE and na.print specified, an
> incorrect amount of spaced is provided for NA columns leading to incorrect
> formatting:
> 
> 
> > a <- matrix( c(NA, "a", "b", "10",
> +                NA, NA,  "d", "12",
> +                NA, NA,  NA,  "14"),
> +              byrow=T, ncol=4 )
> > print(a) # correct
>      [,1] [,2] [,3] [,4]
> [1,] NA   "a"  "b"  "10"
> [2,] NA   NA   "d"  "12"
> [3,] NA   NA   NA   "14"
> > print(a, right=T) # correct
>      [,1] [,2] [,3] [,4]
> [1,]   NA  "a"  "b" "10"
> [2,]   NA   NA  "d" "12"
> [3,]   NA   NA   NA "14"
> > print(a, right=T, na.print=" ") # wrong
>      [,1] [,2] [,3] [,4]
> [1,]      "a"  "b" "10"
> [2,]          "d" "12"
> [3,]             "14"
> > print(a, right=T, na.print="      ") # wrong
>      [,1]   [,2]   [,3]   [,4]
> [1,]               "a"    "b" "10"
> [2,]                          "d" "12"
> [3,]                                  "14"
> >  
> 
> 
> This does not occur with numeric matrixes:
> 
> > a <- matrix( c(NA, 1.0, 2.0, 3.0,
> +                NA, NA,  4.0, 5.0,
> +                NA, NA,   NA, 6.0 ),
> 
> +                byrow=T, ncol=4 )
> > print(a)
>      [,1] [,2] [,3] [,4]
> [1,]   NA    1    2    3
> [2,]   NA   NA    4    5
> [3,]   NA   NA   NA    6
> > print(a,right=T)
>      [,1] [,2] [,3] [,4]
> [1,]   NA    1    2    3
> [2,]   NA   NA    4    5
> [3,]   NA   NA   NA    6
> > print(a,right=T,na.print=" ")
>      [,1] [,2] [,3] [,4]
> [1,]         1    2    3
> [2,]              4    5
> [3,]                   6
> > print(a, right=T, na.print="      ")
>        [,1]   [,2]   [,3] [,4]
> [1,]             1      2    3
> [2,]                    4    5
> [3,]                         6
> >
> 


LEGAL NOTICE\ Unless expressly stated otherwise, this message is... {{dropped}}


[Rd] FW: print.matrix incorrectly formatting string matrixes when righ (PR#3058)
gregory_r_warnes@groton.pfizer.com