Thank you for the code. I had one follow-up question. How can I now cycle
through the remaining columns? I think there may be a problem because the
first iteration destroys the symmetry of the matrix.
Greg
At 08:25 PM 4/29/99 -0400, you wrote:
>
>
>That particular example can be done with
>
>
>X[,-1] <- sweep(X[,-1],2,STATS=1-X[1,-1],FUN="*")
>
>
>I think. You will want to check, maybe the second arg should be a 1.
>
>
> SDB
>
>On Thu, 29 Apr 1999, Greg Bond wrote:
>
>|
>|Hello,
>|
>|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.
>|
>|1 0 0 1 0 0 0 0 1 0
>|0 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|1 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|1 1 1 1 1 1 1 1 1 1
>|0 1 1 1 1 1 1 1 1 1
>|
>|The data above should convert to
>|
>|1 0 0 0 0 0 0 0 0 0
>|0 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|1 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|1 1 1 0 1 1 1 1 0 1
>|0 1 1 0 1 1 1 1 0 1
>|
>|Thanks for any help.
>|
>|Greg Bond
>|
>|-----------------------------------------------------------------------
>|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
>|
>
-----------------------------------------------------------------------
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
|