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 ne
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 <- matrix(c(1,2,3,4),2,2)
>> A
> [,1] [,2]
> [1,
> 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,
>
> [,1] [,2] [,3] [,4] [,5
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
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
5 matches
Mail list logo