Re: [R] A 'good' way to build a matrix from a sequence of integers?

2013-10-15 Thread arun
Hi, You could use:  as.matrix(expand.grid(vec1x3,vec1x3)) #or as.matrix(expand.grid(rep(list(vec1x3),2))) #or library(gtools) permutations(3, 2, vec1x3, repeats.allowed=TRUE) A.K. On Tuesday, October 15, 2013 7:14 PM, Stock Beaver wrote: # I understand that a good way to build a vector fro

Re: [R] A 'good' way to build a matrix from a sequence of integers?

2013-10-15 Thread Kevin E. Thorpe
On 10/15/2013 07:11 PM, Stock Beaver wrote: # I understand that a good way to build a vector from a sequence of integers, # is to use syntax like this: myvec = c(1:99) First, the c() is not needed here. myvec <- 1:99 works just fine. # Here is the 'short' version of my question: # I want t

[R] A 'good' way to build a matrix from a sequence of integers?

2013-10-15 Thread Stock Beaver
# I understand that a good way to build a vector from a sequence of integers, # is to use syntax like this: myvec = 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