[R] How to generating diagnal blocks ?

2006-09-21 Thread Tong Wang
Hi,
 I am trying to creat a matrix with diagnal blocks, say, I have a matrix X 
of any dimension (nxm) ,and would like to have:
   
X
X
X
  .
otherwise space filled with 0's.   Is there a handy way to do this ?

Thanks a lot in advance.

best

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to generating diagnal blocks ?

2006-09-21 Thread vito muggeo
If I remember well, there should be a package including the function 
bdiag() making the job..but I am not able to remember its name..

However a quick search via RSiteSearch(bdiag) yields

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/40393.html

Hope this helps you,

vito


Tong Wang wrote:
 Hi,
  I am trying to creat a matrix with diagnal blocks, say, I have a matrix 
 X of any dimension (nxm) ,and would like to have:

 X
 X
 X
   .
 otherwise space filled with 0's.   Is there a handy way to do this ?
 
 Thanks a lot in advance.
 
 best
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to generating diagnal blocks ?

2006-09-21 Thread Robin Hankin
Hello

You need adiag(), which
is now part of the magic package:


  library(magic)
  adiag(matrix(1:6,2,3),matrix(1:9,3,3))
  [,1] [,2] [,3] [,4] [,5] [,6]
[1,]135000
[2,]246000
[3,]000147
[4,]000258
[5,]000369
 


the function also has extra functionality over the one Vito
points to in the archives.

HTH

rksh


On 21 Sep 2006, at 08:14, vito muggeo wrote:

 If I remember well, there should be a package including the function
 bdiag() making the job..but I am not able to remember its name..

 However a quick search via RSiteSearch(bdiag) yields

 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/40393.html

 Hope this helps you,

 vito


 Tong Wang wrote:
 Hi,
  I am trying to creat a matrix with diagnal blocks, say, I  
 have a matrix X of any dimension (nxm) ,and would like to have:

 X
 X
 X
   
  .
 otherwise space filled with 0's.   Is there a handy way to do this ?

 Thanks a lot in advance.

 best

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.



 -- 
 
 Vito M.R. Muggeo
 Dip.to Sc Statist e Matem `Vianelli'
 Università di Palermo
 viale delle Scienze, edificio 13
 90128 Palermo - ITALY
 tel: 091 6626240
 fax: 091 485726/485612

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.