Re: [R] create one bigger matrix with one smaller matrix

2015-12-31 Thread Giorgio Garziano
A <- matrix(c(1,2,3,4),2,2) B <- matrix(A, nrow=14, ncol=14) > B [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,]131313131 3 1 3 1 3 [2,]242424242 4 2 4

Re: [R] create one bigger matrix with one smaller matrix

2015-12-31 Thread David Winsemius
> On Dec 31, 2015, at 12:28 PM, Kathryn Lord wrote: > > Dear R users, > > Suppose that I have a matrix A > > A <- matrix(c(1,2,3,4),2,2) >> A > [,1] [,2] > [1,]13 > [2,]24 > > With this matrix A, I'd like to create bigger one, for example, > >

Re: [R] create one bigger matrix with one smaller matrix

2015-12-31 Thread Bert Gunter
Well, all of the solutions proposed are a bit tricky in that the matrix must be "constructed" by hand. They are also reinventing wheels. What I think you really want is the kronecker product, which is the matrix operation that does exactly what you want. e.g. A <- matrix(1:4, nr=2) to create a

[R] create one bigger matrix with one smaller matrix

2015-12-31 Thread Kathryn Lord
Dear R users, Suppose that I have a matrix A A <- matrix(c(1,2,3,4),2,2) > A [,1] [,2] [1,]13 [2,]24 With this matrix A, I'd like to create bigger one, for example, [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,]1313

Re: [R] create one bigger matrix with one smaller matrix

2015-12-31 Thread Michael Hannon
Something like: A <- matrix(c(1,2,3,4),2,2) A B <- matrix(rep(A, 4), nrow=2) B C <- do.call(rbind, lapply(1:8, function(x) B)) C On Thu, Dec 31, 2015 at 12:28 PM, Kathryn Lord wrote: > Dear R users, > > Suppose that I have a matrix A > > A <-