s-news
[Top] [All Lists]

[S] Re:

To: Greg Bond <gbond@hbs.edu>
Subject: [S] Re:
From: Adelchi Azzalini <adelchi.azzalini@jrc.it>
Date: Fri, 30 Apr 1999 10:46:43 +0100
Cc: s-news@wubios.wustl.edu
Organization: J.R.C.
References: <199904300017.UAA17081@listserv.hbs.edu>
Reply-to: adelchi.azzalini@jrc.it
Sender: owner-s-news@wubios.wustl.edu


> I?m new to Splus and I have a question about a data transformation.  I have a
> symmetric matrix of 3000x3000 and I want to use the observations within one
> column to change all the values of another column to zero.  For example, in 
> the
> simple data set below, every time I find a 1 in column 1, I want all the cases
> in the ith column to be zero (excluding the first column).  In other words,
> column 1 is fixed, and whenever a 1 is encountered in row j, the jth column is
> set equal to 0, except for j=1.
> 

Hi. You could do the following:

  x[x[,1]==1,-1] <- rep(0,ncol(x)-1)

Regards
Adelchi Azzalini
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>