Skip to content

How to count numbers of a vector and use them as index values?from Sabrina

2 messages · Sabrina Friedman, Dennis Murphy

#
Hi Paul,

I would use something like this:
x
2 3 4 6
2 2 1 1
x
1 2 3 4 5 6 7 8
0 2 2 1 0 1 0 0

Sarah

On Sun, Jul 31, 2011 at 5:41 PM, Paul Menzel
<paulepanter at users.sourceforge.net> wrote:

  
    
#
Hi:

Another possibility is
[1] 0 2 2 1 0 1 0 0

where the second argument of tabulate() allows one to specify the
number of bins, in order from 1 up to the specified value, with all
others outside that range ignored.

HTH,
Dennis

On Thu, Aug 18, 2011 at 12:29 PM, Sabrina Friedman
<utebachmeier at gmail.com> wrote: