I'm new bee to R programming. I want to know how to create a 2 dimensional array of vectors which are of different lengths. This is what I'm trying to do:
A = c(1, 2, 3, 4)
B = c(5, 6, 7)
C = c(10, 11, 12, 13)
D = c(14, 15, 16)
E = c(21, 22, 23, 24)
F = c(25, 26, 27)
mat = matrix(nrow=3, ncol=2)
#This code does not work
mat[1, 1] = A
mat[1, 2] = B
mat[2, 1] = C
mat[2, 2] = D
mat[3, 1] = E
mat[3, 2] = F
I would like to get mat to contain the following:
[,1] [,2]
[1,] 1 2 3 4 5 6 7
[2,] 10 11 12 13 14 15 16
[3,] 21 22 23 24 25 26 27
Can someone help me with this?