0

So I have this matrix, hail_outbreaks , that has a column that tells you hail reports (it is column 3). Now I am having a hard time answering this question. The question says determine the number of hail reports and the IQR for events that are above the ranking of 0.25 "major events" and those below 0.25 "non-major events". It says that you assume this threshold is a ranking index of 0.25. I am getting confused on how to find the rows in the column that are > 0.25 and < 0.25. I was told to use a which() statement or to use a loop to filter down the data.

10 Rep
  • 2,325
  • 7
  • 15
  • 28
Stephanie
  • 1
  • 1
  • 2
    Please do read up on [how to make a reproducible example](http://stackoverflow.com/q/5963269/903061). I *doubt* you have a matrix - probably you have a data frame - but I could be wrong. Data types can make a big difference in syntax. I also have no idea what you mean by "IQR for events" - do you mean the IQR of the third column? – Gregor Thomas Jun 16 '16 at 23:38
  • 2
    Especially for beginner questions, you'll learn much more if you show what you tried. This is probably a short one-liner in R, but you'll learn much more from someone dissecting why your attempts didn't work than from someone just giving you the answer. You might also want to look at similar questions. These two came up when I searched for "R subset multiple conditions" [q1](http://stackoverflow.com/q/22475189/903061), [q2](http://stackoverflow.com/q/4935479/903061). But this may just be a question of "how do I subset data in R", which you should probably read a tutorial for. – Gregor Thomas Jun 16 '16 at 23:41

1 Answers1

3

One way to get the number of events greater than 0.25 is

table(hail_outbreaks[,3]>0.25)

If none are exactly 0.25, then the count for FALSE is the amount less than as well.

> tmpvec <- 1:30
> table(tmpvec > 25)

FALSE  TRUE 
   25     5