Re: [R] question involving loops from intro level R programming class

2008-11-28 Thread Gustaf Rydevik
On Fri, Nov 28, 2008 at 8:35 AM, Heidi Wong <[EMAIL PROTECTED]> wrote: > a. Write a R function zerdiag.v1(m) using loop to output a square matrix > whose diagonal elements are zero and the other elements are filled in by > consecutive integers from 1 to m row-wise. > > For example, > zerdiag.v1(6)

Re: [R] question involving loops from intro level R programming class

2008-11-28 Thread Richard . Cotton
> a. Write a R function zerdiag.v1(m) using loop to output a square matrix > whose diagonal elements are zero and the other elements are filled in by > consecutive integers from 1 to m row-wise. > > For example, > zerdiag.v1(6) = [0, 1, 2] > [3, 0, 4] >

[R] question involving loops from intro level R programming class

2008-11-28 Thread Heidi Wong
a. Write a R function zerdiag.v1(m) using loop to output a square matrix whose diagonal elements are zero and the other elements are filled in by consecutive integers from 1 to m row-wise. For example, zerdiag.v1(6) = [0, 1, 2] [3, 0, 4] [5, 6,