On Wed, Mar 11, 2009 at 11:49 PM, Sundar Dorai-Raj <sdorai...@gmail.com> wrote:
> Does this help?
>
> A <- matrix(0, 6, 6)
> vec <- 1:5
> A[row(A) == col(A) + 1] <- vec

Maybe, more simply:

A <- matrix(0, 6, 6)
vec <- 1:5
diag(A[-1,]) <- vec

Paul

______________________________________________
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.

Reply via email to