[R] selecting subsets of data from matrix

Corey Moffet cmoffet at nwrc.ars.usda.gov
Mon Oct 20 19:59:13 CEST 2003


try:

mat[(mat[,20] > 315 | mat[,20] < 45),]


At 06:41 PM 10/20/2003 +0100, 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
>
With best wishes and kind regards I am

Sincerely,

Corey A. Moffet, Ph.D.
Support Scientist

University of Idaho
Northwest Watershed Research Center
800 Park Blvd, Plaza IV, Suite 105
Boise, ID 83712-7716

Voice: (208) 422-0718
FAX:   (208) 334-1502




More information about the R-help mailing list