[R] Selecting out certain values from a MATRIX
spector at stat.Berkeley.EDU
Tue Apr 4 21:19:33 CEST 2006
myMatrix[myVector < .5,]
- Phil Spector
Statistical Computing Facility
Department of Statistics
spector at stat.berkeley.edu
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.
> myMatrix = a matrix of 8000 by 20
> myVector = vector of 8000
> myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in
> I hope this makes sense..
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help