[R] matrix output

Duncan Murdoch murdoch at stats.uwo.ca
Tue Feb 17 23:39:17 CET 2009


On 17/02/2009 5:31 PM, phoebe kong wrote:
> Hi friends,
> 
> I have questions about printing a pretty big size matrix.
> 
> As you could see from below, the matrix wasn't showed in R at full size
> (11X11), but it was cut partly into three smaller matrices (11X4,11X4,11X3).
> I'm wondering if there is a way to show the whole matrix with dimension
> 11X11, do you know how to make it?

If you increase the output width, e.g.

options(width=10000)

won't wrap (but it'll probably be too wide to be useful).  You can also 
reduced the number of decimal places, e.g.

SYrounded <- round(SY, 3)


> 
> If R really couldn't fit the full big matrix at once, what about output the
> FULL matrix to a .pdf document? I have been wondering for a long time if we
> could output something other than graphic, like data frame or text, to a
> .pdf file.

The main way to produce nice text in a PDF document through R is to use 
Sweave and LaTeX.  Too much explanation needed for a simple example here.

Duncan Murdoch

> 
> Thanks in advance for your patience and answer.
> 
> SY
> 
>                             Sldur     Slonset         Waso      Sboutn
> Sldur                            1  -0.6744252  -0.08427312  -0.2871798
> Slonset                        327   1.0000000   0.14257353   0.1981339
> Waso                           327 327.0000000   1.00000000   0.5104723
> Sboutn                         327 327.0000000 327.00000000   1.0000000
> MidSleep                       327 327.0000000 327.00000000 327.0000000
> SleepEff                       327 327.0000000 327.00000000 327.0000000
> NumTrials                       22  22.0000000  22.00000000  22.0000000
> MeanTrials                      22  22.0000000  22.00000000  22.0000000
> MedianTrials                    22  22.0000000  22.00000000  22.0000000
> NS3all5tage                    296 296.0000000 296.00000000 296.0000000
> HGsoc118                       325 325.0000000 325.00000000 325.0000000
> 
>                                  MidSleep    SleepEff   NumTrials
> MeanTrials
> Sldur                         -0.14512244   0.6721889  0.26482213
> 0.26256352
> Slonset                        0.73991223  -0.5613362 -0.09429701
> -0.02540937
> Waso                           0.08729977  -0.6836098  0.18577075
> 0.26369283
> Sboutn                         0.06169839  -0.4895902  0.10897798
> 0.07058159
> MidSleep                       1.00000000  -0.1498673 -0.17786561
> 0.13043478
> SleepEff                     327.00000000   1.0000000 -0.01637493
> -0.20835686
> NumTrials                     22.00000000  22.0000000  1.00000000
> -0.16768424
> MeanTrials                    22.00000000  22.0000000 46.00000000
> 1.00000000
> MedianTrials                  22.00000000  22.0000000 46.00000000
> 46.00000000
> NS3all5tage                  296.00000000 296.0000000 44.00000000
> 44.00000000
> HGsoc118                     325.00000000 325.0000000 44.00000000
> 44.00000000
> 
>                              MedianTrials  NS3all5tage     HGsoc118
> Sldur                           0.1857708   0.07849234  -0.03751973
> Slonset                         0.2919255  -0.14858206   0.05323562
> Waso                            0.3856578  -0.08148054   0.09341454
> Sboutn                          0.2557877  -0.05049218   0.06847118
> MidSleep                        0.4172784  -0.09344423   0.05287818
> SleepEff                       -0.3088650   0.12099185  -0.08453191
> NumTrials                      -0.1108233  -0.06779422  -0.13164200
> MeanTrials                      0.9203207  -0.07625088   0.10584919
> MedianTrials                    1.0000000  -0.10894996   0.13615222
> NS3all5tage                    44.0000000   1.00000000  -0.10554137
> HGsoc118                       44.0000000 632.00000000   1.00000000
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list