Draw a Hankel matrix with R -
I want to create a Hankel matrix with R only E1 used the library to attract Henkel matrix and in E2, I manually numbers to attract one, but if I need a new big matrix It will take a lot of time I tried to use the I'm still very new to R. Every idea is welcome. You can: Or more elegant but using The solution works by: matrix () ,
seq Use () and
rep () R of the function till now, I like to attract it in some way:
# With packages, required Install.packages ("MatrixCellCase") library (matrixcalci) E1 & lt; - hankel.matrix (5, seq (1, 9)) print (E1) # Usage matrix () Only, E2 efficient and lt; - Matrix C (1,2,3,4,5,2,3,4,5,6,3,4,5,6,7,4,5,6,7,8,5,6,7, 8, 9), Nackel = 5) print (E2) # UK Seek (), but E3 and LT; - Matrix (C (1: 5), CEC (2: 6), CEC (3: 7), Seac 4: 8), CEC (5: 9)), Nackel = 5) Print (E3) / Code>
seq () but it did not work it would come like this:
[, 1] [, 2] [, 3] [, 4] [, 5] [1,] 1 1 1 1 [2,] 2 2 2 2 2 [3,] 3 3 3 3 [4,] 4 4 4 4 4 [5,] 5 5 5 5 5
matrix ([(1 : 5,5) + Representative (0: 4, each = 5), ncol = 5) # [, 1] [, 2] [, 3] [, 4] [, 5] # [1,] 1 2 3 4 5 # [2,] 2 3 4 5 6 # [3,] 3 4 5 6 7 # [4,] 4 5 6 7 8 # [5,] 5 6 7 8 9
external :
external (0: 4,1: 5, '+') using
Edit:
12345 12345 12345 ... (representative time , Repeat vector n bar + 00000 11111 22222 ... (with each Rattanidhi, repeat each element n times = 12345 23456 34567 .....
external may be difficult for the first time, you may find it more common Can understand the debug.
Comments
Post a Comment