[R] block matrices

Kjetil Halvorsen kjetilbrinchmannhalvorsen at gmail.com
Wed Feb 24 17:06:03 CET 2010


see below.

On Wed, Feb 24, 2010 at 12:56 PM, Gustave Lefou <gustave5000 at gmail.com> wrote:
> Dear all,
>
> I do not know how to deal with block matrices in R.
>
> For example I have 3 matrices A, B and C.
>
> And I want to produce a new matrix of this form
>
> ( A B 0 )
> ( 0 0 C )
>
> where A, B and C are one-row matrices.

   cbind(A,B,0) or maybe
   cbind(a,B,rep(0, 12))

   cbind(rep(0,2), C)

>
> Apart from A, B and C, all the coefficients are 0.
>
> Is there an easy solution in R for every block matrices ?

Combine rbind and cbind:
?rbind

Kjetil

>
> Thanks for your help,
> Gustave
>
> P.S. : I have had a look at a function called "zoo" which looked quite
> complicated to me.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list