search for: vec1x3

Displaying 1 result from an estimated 1 matches for "vec1x3".

2013 Oct 15
2
A 'good' way to build a matrix from a sequence of integers?
...c(1:99) # Here is the 'short' version of my question: # I want to understand a 'good' way to build a matrix from a sequence of integers. # If that question is not clear, here is a longer version: # Here is what I did for a 1D-matrix: # I pick the sequence 1:3 # I build a vector: vec1x3 = c(1:3) vec1x3 # I transform it into a 1 x 3 matrix: m1x3 = matrix(vec1x3, c(length(vec1x3),1)) m1x3 #      [,1] # [1,]    1 # [2,]    2 # [3,]    3 # > # That was easy. # Next I want to expand from a 1 x 3 matrix to a 2 x 9 matrix # which contains all combinations of 1:3 # So the first 4 r...