Skip to content
Back to formatted view

Raw Message

Message-ID: <BAY102-F28F62969DBE260059CB484D3840@phx.gbl>
Date: 2005-10-07T22:01:41Z
From: Dhiren DSouza
Subject: matrix operation

Hello:

I have a matrix 'dat' with 2 columns.

I have the following code:

for (i in 1:nrows(dat))
{
  if (dat[i,1] < dat[i,2])
    {
      dat[i,2]<-0
    }

   else
   {
     dat[i,2]<-1
   }


Is there a way to accomplish this without the for loop?

Thank you.

-Dhiren