[R] Binning data

David Winsemius dwinsemius at comcast.net
Sun Mar 13 07:05:50 CET 2011


On Mar 12, 2011, at 11:35 PM, johnbeamer wrote:

> Hello
>
> I have a large series of data value -- effectivly say the point  
> across the
> x-axis where a pitch crosses home plate. What I want to do is find  
> the % of
> ground balls at various distances across home plate.
>
> I therefore need to 'bin' the two data sets I have - plate location  
> for
> ground balls and plate location for all other outcomes.
>
> Question is how can I set up a series of bins between x and y with  
> bin width
> (y-x)/200, as an example ...

Most probably a combination of:

?seq
?cut


You might also want to look at findInterval but that would not seem to  
be necessary in this instance. It's really an excellent function for  
doing indexed lookups, though.

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list