myMatrix[myVector < .5,] or subset(myMatrix,myVector< .5) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley [EMAIL PROTECTED]
On Tue, 4 Apr 2006, mark salsburg wrote: > I have two objects, one matrix and one vector. > > I want to use my vector to subset certain values out of my matrix. > > For example: > > I want to tell R, to select out all rows in myMatrix into a new myMatrix2 IF > that corresponding row is less than a 0.5 in myVector. > > So: > > myMatrix = a matrix of 8000 by 20 > myVector = vector of 8000 > > myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in > myVector) > > I hope this makes sense.. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html