Skip to content
Prev 379049 / 398502 Next

Printing vectrix

Here are a couple of other options. One changes the console width and the other pads the matrix before printing:
[1]  1  2  3  4  5  6  7  8  9 10
[11] 11 12 13 14 15 16 17 18 19 20
[21] 21 22 23 24 25
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
[2,]   11   12   13   14   15   16   17   18   19    20
[3,]   21   22   23   24   25                          

----------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of K. Elo
Sent: Monday, March 25, 2019 2:26 AM
To: r-help at r-project.org
Subject: Re: [R] Printing vectrix

Hi!
2019-03-25 kello 09:30 +0800, Steven Yen wrote:
Something like this?

x<-1:25; for (i in seq(1,length(x),10))
print(x[i:ifelse((i+9)>length(x),length(x),i+9)])

HTH,
Kimmo

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.