From hpages at fredhutch.org  Wed Mar 16 08:39:07 2016
From: hpages at fredhutch.org (=?UTF-8?B?SGVydsOpIFBhZ8Oocw==?=)
Date: Wed, 16 Mar 2016 00:39:07 -0700
Subject: [Rd] print( , right=TRUE) displays the col numbers on the left
Message-ID: <56E90D9B.7060603@fredhutch.org>

Hi,

I noticed that when using print( , right=TRUE) on a character
matrix with no colnames, the col numbers get displayed on the
left of each column:

 > m <- matrix(rep(c("XXXXXX", "XXXX"), 6), ncol=3)

 > print(m, right=FALSE)
      [,1]     [,2]     [,3]
[1,] "XXXXXX" "XXXXXX" "XXXXXX"
[2,] "XXXX"   "XXXX"   "XXXX"
[3,] "XXXXXX" "XXXXXX" "XXXXXX"
[4,] "XXXX"   "XXXX"   "XXXX"

 > print(m, right=TRUE)
      [,1]     [,2]     [,3]
[1,] "XXXXXX" "XXXXXX" "XXXXXX"
[2,]   "XXXX"   "XXXX"   "XXXX"
[3,] "XXXXXX" "XXXXXX" "XXXXXX"
[4,]   "XXXX"   "XXXX"   "XXXX"

OTOH if the matrix has colnames, they do get displayed on the
right of each column when 'right=TRUE':

 > colnames(m) <- letters[1:3]

 > print(m, right=FALSE)
      a        b        c
[1,] "XXXXXX" "XXXXXX" "XXXXXX"
[2,] "XXXX"   "XXXX"   "XXXX"
[3,] "XXXXXX" "XXXXXX" "XXXXXX"
[4,] "XXXX"   "XXXX"   "XXXX"

 > print(m, right=TRUE)
             a        b        c
[1,] "XXXXXX" "XXXXXX" "XXXXXX"
[2,]   "XXXX"   "XXXX"   "XXXX"
[3,] "XXXXXX" "XXXXXX" "XXXXXX"
[4,]   "XXXX"   "XXXX"   "XXXX"

That looks better!

Shouldn't the same happen for the col numbers when 'right=TRUE'?

Thanks,
H.

 > sessionInfo()
R Under development (unstable) (2016-01-07 r69884)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



[Rd] print( , right=TRUE) displays the col numbers on the left
=?UTF-8?B?SGVydsOpIFBhZ8Oocw==?=