[R] Vector Manipulation

Marc Schwartz mschwartz at medanalytics.com
Mon Jul 22 04:25:45 CEST 2002


> Greetings,
> 
> 
> I wonder if someone could point me towards a more elegent solution
than
> what I"ve kluged together. I have a vector "samp1" of 296 integers.
> They are sorted in ascending order and the numbers range from 177 to
> 228,953. I'd like to specify N non-overlapping intervals covering the
> range from 0 to 229,354 and then for each range, count the number of
> integers from samp1 that fall into that range. What I'll end up with
is
> an N element vector with each element representing the number of
> integers from samp1 found in the Nth range.
> 		
> 
> Can someone point me to a function / procedure that allows me to
specify
> 
> the non-overalpping intervals? and also one that I can use to do the
> counting?
> 
> 
> Best,
> Bill Vedder

Bill,

Take a look at ?cut and ?hist.  With hist(), look at the values returned
when "plot = FALSE".

HTH.

Marc


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list