Re: [R] frequency of numbers in a list

2009-08-08 Thread Phil Spector
Julius - Both mag and i are vectors, but of different lengths. R interprets the statement mag>=i as "return a vector the same length as mag and i whose elements compare the corresponding elements of the two vectors." The error message is due to the fact that mag and i are of different lengt

[R] frequency of numbers in a list

2009-08-07 Thread Julius Tesoro
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 messag