Hi
adiag() from the magic package does what you want:
library(magic)
Loading required package: abind
a - matrix(1,2,2)
b - matrix(6,2,3)
adiag(a,b)
[,1] [,2] [,3] [,4] [,5]
[1,]11000
[2,]11000
[3,]00666
[4,]006
Dear R-users,
Does anybody know how to construct a block-diagonal matrix (with the blocks
being different matrixs, concerning the dimension and the values) ?
I would like to know also if there is any package that generates values from a
multivariate skew normal distribution.
Thanks all,
For your first question, here's a function originally posted by Ben Bolker,
with modification by Rich Raubertas:
blockdiag - function (x, ...)
{
if (!is.list(x))
x - list(x)
args - list(...)
if (length(args) 0)
args - c(x, args)
else args - x
idx -
Dear R-users,
Does anybody know how to construct a block-diagonal matrix (with the blocks
being different matrixs, concerning the dimension and the values), without use
loops ?
Thanks all,
Caio
-
[[alternative HTML version
Hello List
I have just written a little function that takes two matrices as
arguments and returns a large matrix that is composed of the two input
matrices in upper-left position and lower-right position with a padding
value everywhere else. (function definition and toy example below). I
need
: Robin Hankin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 27, 2004 10:24 AM
Subject: [R] block diagonal matrix function
Hello List
I have just written a little function that takes two matrices as
arguments and returns a large matrix that is composed of the two
input
matrices