I have a vector and I want to split it into multiple vectors with some pattern. For example:
a table x with a vector of 14 numbers like:
x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
I want to create a new table with multiple vectors based on above vector
n=2,m1=3,m2=4
column n=2, for column1:row=n*m1 and column2: row= n*m2 (Here, the number could be variables)
1 7
2 8
3 9
4 10
5 11
6 12
13
14
Many thanks
markus's solution is correct. Many thanks.
n <- 2; split(1:14, rep(1:2, n*3:4))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.