如何使R语言结果显示在一行中

时间:2011-12-05 03:30:17

标签: r

  

可能重复:
  Increase the width of matrix printout

我有一个名为S的大矩阵,因此它会显示多行分隔的结果。这对我来说不是很清楚,所以有没有办法显示整个矩阵,让列打印在这样的分隔行上:

> S
           [,1]      [,2]      [,3]       [,4]      [,5]       [,6]      [,7]
 [1,] 1.0000000 0.5393599 0.5276449 0.33449680 0.2925090 0.60927180 0.2925090
 [2,] 0.5393599 1.0000000 0.7826238 0.43412157 0.6507914 0.51639778 0.5423261
 [3,] 0.5276449 0.7826238 1.0000000 0.41602515 0.5457052 0.50518149 0.5457052
 [4,] 0.3344968 0.4341216 0.4160251 1.00000000 0.2690691 0.08006408 0.3363364
 [5,] 0.2925090 0.6507914 0.5457052 0.26906912 1.0000000 0.42008403 0.5294118
 [6,] 0.6092718 0.5163978 0.5051815 0.08006408 0.4200840 1.00000000 0.4900980
 [7,] 0.2925090 0.5423261 0.5457052 0.33633640 0.5294118 0.49009803 1.0000000
 [8,] 0.4029115 0.5378529 0.6013378 0.44474959 0.6482037 0.46291005 0.5185630
 [9,] 0.3636364 0.5393599 0.5276449 0.16724840 0.6581452 0.52223297 0.4387635
[10,] 0.2727273 0.4045199 0.4522670 0.25087260 0.5850179 0.43519414 0.6581452
[11,] 0.4351941 0.6454972 0.5773503 0.32025631 0.4900980 0.41666667 0.4200840
[12,] 0.3636364 0.6741999 0.5276449 0.33449680 0.5850179 0.34815531 0.4387635
[13,] 0.1906925 0.2828427 0.1581139 0.43852901 0.3834825 0.18257419 0.3834825
           [,8]      [,9]     [,10]     [,11]     [,12]     [,13]
 [1,] 0.4029115 0.3636364 0.2727273 0.4351941 0.3636364 0.1906925
 [2,] 0.5378529 0.5393599 0.4045199 0.6454972 0.6741999 0.2828427
 [3,] 0.6013378 0.5276449 0.4522670 0.5773503 0.5276449 0.1581139
 [4,] 0.4447496 0.1672484 0.2508726 0.3202563 0.3344968 0.4385290
 [5,] 0.6482037 0.6581452 0.5850179 0.4900980 0.5850179 0.3834825
 [6,] 0.4629100 0.5222330 0.4351941 0.4166667 0.3481553 0.1825742
 [7,] 0.5185630 0.4387635 0.6581452 0.4200840 0.4387635 0.3834825
 [8,] 1.0000000 0.6446584 0.5640761 0.4629100 0.5640761 0.4225771
 [9,] 0.6446584 1.0000000 0.6363636 0.3481553 0.4545455 0.2860388
[10,] 0.5640761 0.6363636 1.0000000 0.2611165 0.3636364 0.4767313
[11,] 0.4629100 0.3481553 0.2611165 1.0000000 0.5222330 0.2738613
[12,] 0.5640761 0.4545455 0.3636364 0.5222330 1.0000000 0.1906925
[13,] 0.4225771 0.2860388 0.4767313 0.2738613 0.1906925 1.0000000

2 个答案:

答案 0 :(得分:3)

除了打印(...,数字)方法,您还可以更改打印包装的宽度:

options(width = 150)

答案 1 :(得分:2)

让你的窗户宽阔......

并且,取决于计数的数字位数...

print(S, digits = 3)

但你确实需要提出更好的方法来检查不依赖于此类事物的相关矩阵。