[R] matrix

From: Val <valkremk_at_gmail.com>
Date: Tue, 26 Apr 2011 17:28:13 -0400


Hi all,

Assume I have a matrix
xv= [1 0 0 0 0 12,

      0 1 0 0 0 10,

if the last column of "xv" less than 0 then I want to set zero the entire row.
The desired output looks like the following. In this case row 3 and row 5 are set zero.

    [ 1 0 0 0 0 12,
      0 1 0 0 0 10,
     * 0 0 0 0 0 0,*
      0 0 0 1 0 20,

I used ifelse command but did not work

Is there another command to do that?

Thanks in advance
\

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
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. Received on Tue 26 Apr 2011 - 21:30:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 22:00:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive