[R] selecting subsets of data from matrix

Ben Bolker bolker at zoo.ufl.edu
Mon Oct 20 20:05:34 CEST 2003


 x[x[,20]<45 | x[,20]>315, ]

On Mon, 20 Oct 2003, Laura Quinn wrote:

> Probably a stupid question, but I don't seem to be able to find the answer
> I'm looking for from any of the R literature. Basically I have a matrix
> with several thousand rows and 20 columns(weather stations) of wind
> direction data.
> 
> I am wanting to extract a matrix which contains data for all columns
> conditional on column 20 having a value of _either_ less than 45 or
> greater than 315. (ie I want to extract a matrix which contains wind direction
> data for all columns {weather stations} when there is a prevailing
> northerly wind for one of the stations).
> 
> I have tried a few different methods of doing this, none with any success,
> can anyone please advise?
> 
> Thanks in advance!
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
620B Bartram Hall                            bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704




More information about the R-help mailing list