I have a list of vectors, for example:
[[1]] [1] 1 2 7 9 10 13 14 15 20 [[2]] [1] 3 4 5 6 [[3]] [1] 8 11 12 [[4]] [1] 16 17 18 19 [[5]] [1] 21 22 23
I want to convert a list to a matrix where the contents of each vector are associated with the index number of the list in double brackets.
Example:
[,1] [,2] [1,] 1 1 [2,] 1 2 [3,] 1 7 [4,] 1 9 [5,] 1 10 [6,] 1 13 [7,] 1 14 [8,] 1 15 [9,] 1 20 [10,] 2 3 [11,] 2 4 [12,] 2 5 [13,] 2 6 [14,] 3 8 [15,] 3 11 [16,] 3 12 [17,] 4 16 [18,] 4 17 [19,] 4 18 [20,] 4 19 [21,] 5 21 [22,] 5 22 [23,] 5 23
user2299015
source share