[R] frequency of numbers in a list

Julius Tesoro jutesoro at yahoo.com
Sat Aug 8 04:17:13 CEST 2009


Hi,

I have two vectors, mag and i, and I want to generate a of vector  where each element is the frequency of mag which is greater than i.

i produced the following code. However I get the following error:

mag<-rnorm(40,5,3)
i<-seq(floor(min(mag)),max(mag), 0.5)
freq<-sum(mag>=i)

Warning message:
In mag >= i :
  longer object length is not a multiple of shorter object length

What's wrong with this code?

Thank you very much.

Cheers,

Julius Tesoro




More information about the R-help mailing list