On Tue, Sep 7, 2010 at 9:09 AM, Trafim Vanishek <rdapam...@gmail.com> wrote: > Dear all, > > seems that easy question but cannot find the function for that. > How to get the elements of the minor diagonal of the matrix? >
Here are a few possibilities: # test matrix x <- matrix(1:16, 4) # 1 diag(x[, nrow(x):1]) # 2 rev(x[row(x) + col(x) == nrow(x) + 1]) # 3 x[to = seq(to = nrow(x), by = 1 - nrow(x), length = nrow(x))] # 4 diag(as.matrix(rev(as.data.frame(x)))) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@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.