Try this:
m <- matrix(sample(9), 3)
diag(m)
diag(m[-1,])
diag(m[,-1])
On Mon, Aug 24, 2009 at 4:03 PM, Vaupo <m-vaupo@web.de> wrote:
>
> Hi,
>
> how do i fill the secondary diagonals of a matrix?
> Is there an funktion like the "diag" funktion in matlab, where i
can
> specify
> the diagonal i´d like to fill?
>
> --
> View this message in context:
>
http://www.nabble.com/Filling-matrix-secondary-diagonal-tp25121745p25121745.html
> Sent from the R help mailing list archive at Nabble.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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]