[R] quesion on diag of matrix

Spencer Graves spencer.graves at pdf.com
Tue Feb 24 02:29:46 CET 2004


 > A <- array(1:4, dim=c(2,2))
 > sum(diag(A))
[1] 5

      Is that what you want? 
      spencer graves

li xian wrote:

>How to get the sum of the diag of matrix?
>Thanks!
>
>
>---------------------------------
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list