Thanks for your help everyone, My data is a matrix. However if i use the command:
x[(x[,20] > 315 | x[,20] < 45), ] and then request a summary, I get a warning message saying that a large number of the row names have been duplicated - I don't understand this? On 20 Oct 2003, Douglas Bates wrote: > Laura Quinn <[EMAIL PROTECTED]> writes: > > > 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. > > Is it a matrix or a data frame? > > > 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? > > If x is a matrix they you want > > mysubset <- x[x[,20] < 45 | x[,20] > 315,] > > If x is a data frame and column 20 is named col20 then you can use > > mysubset <- subset(x, col20 < 45 | col20 >315) > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help