Hervé Pagès
2016-Mar-16 07:39 UTC
[Rd] print( , right=TRUE) displays the col numbers on the left
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