[R] Matrix addition function

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 13 15:25:32 CEST 2009


If A, B and C are matrices then:

L <- list(A, B, C)
Reduce("+", L)


On Thu, Aug 13, 2009 at 5:35 AM, Lina Rusyte<linera27 at yahoo.co.uk> wrote:
> Hello,
>
> What function can I use for matrices addition? I couldn’t find any information about it in the manual or in the internet.
> (A+B suits, when the number of matrixes is small, function sum() doesn’t suit for matrices addition, because it sums all variables in the matrices and produces as an answer single number, not a matrix).
>
> Best regards,
> Lina
>
>
>
>
>        [[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