I think this does the work return(m[!as.logical(data)])
I am not sure though if this is the same with return(m[!as.logical(data)]) ________________________________ From: andrija djurovic <djandr...@gmail.com> Cc: "R-help@r-project.org" <R-help@r-project.org> Sent: Sunday, October 30, 2011 9:58 PM Subject: Re: [R] why the a[-indx] does not work? > as.logical(c(1,0,1,1)) [1] Â TRUE FALSE Â TRUE Â TRUE ?as.logical probably you mean > > > > >For â[â-indexing only: âiâ, âjâ, â...â can be logical >vectors, indicating elements/slices to select. Â Such vectors >are recycled if necessary to match the corresponding extent. >âiâ, âjâ, â...â can also be negative integers, indicating >elements/slices to leave out of the selection. > > > >How can i convert the positives to TRUE and zeros and FALSE? > > > >________________________________ >From: William Dunlap <wdun...@tibco.com> > >Sent: Sunday, October 30, 2011 9:17 PM >Subject: RE: [R] why the a[-indx] does not work? > >Â > a[overLoadTesT==0] >Â [1]Â 2Â 4Â 5Â 6Â 7Â 8Â 9 10 >Look into help('[') or help('Subscript') to see >how integer and logical (Boolean) subscripts differ. > >Bill Dunlap >Spotfire, TIBCO Software >wdunlap tibco.com > >> -----Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of Alaios >> Sent: Sunday, October 30, 2011 11:52 AM >> To: R-help@r-project.org >> Subject: [R] why the a[-indx] does not work? >> >> Dear all, >> >> Could you please explain me why >> >> > OverloadsTesT >> [1] 1 0 1 0 0 0 0 0 0 0 >> > a<-matrix(data=seq(1,10),nrow=10) >> > a >> [,1] >> [1,]Â Â 1 >> [2,]Â Â 2 >> [3,]Â Â 3 >> [4,]Â Â 4 >> [5,]Â Â 5 >> [6,]Â Â 6 >> [7,]Â Â 7 >> [8,]Â Â 8 >> [9,]Â Â 9 >> [10,]Â Â 10 >> > a[-OverloadsTesT] >> [1]Â 2Â 3Â 4Â 5Â 6Â 7Â 8Â 9 10 >> >> >> >> the last line does not remove the first and third element and only does the >> first element.? >> >> What I want to do is for zeros to return the elements and for any positive >> value to remove it. >> What I am doing wrong? >> >> B.R >> Alex >> Â Â Â [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@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. >Â Â Â Â [[alternative HTML version deleted]] > > >______________________________________________ >R-help@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. > > [[alternative HTML version deleted]]
______________________________________________ R-help@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.