> Thanks for help!
> However, changing the index from i to j for the column vector changes the
> output. I would like the matrix to be the following:

> -1 1 0 0 0 0 0
> 0 -1 1 0 0 0 0
> 0 0 -1 1 0 0 0
> .....
> etc.

> How to code it?

as Enrico Schumann showed you:  Without any loop, a very nice
R-ish way (see his message)!

Martin

> Best,
> Maija

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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