2 13 14 15 16 17 18 1920
[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 On Behalf Of K. Elo
Sent: Monday, March 25, 2019 2:26 AM
To: r
Hi!
2019-03-25 kello 09:30 +0800, Steven Yen wrote:
> The second command is ugly. How can I print the 25 numbers into 2
> rows
> of ten plus a helf row of 5? Thanks.
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
_
I like to print a vector, wrapped by rows of 10.
Below the first command below works for 20 numbers.
The second command is ugly. How can I print the 25 numbers into 2 rows
of ten plus a helf row of 5? Thanks.
> x<-1:20; matrix(x,nrow=2,byrow=T)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
3 matches
Mail list logo