[R] write a loop for tallies

Peter Langfelder peter.langfelder at gmail.com
Fri Jun 25 00:19:49 CEST 2010


On Thu, Jun 24, 2010 at 3:16 PM, john polo <jpolo at mail.usf.edu> wrote:
> Dear R users,
>
> I have a list of numbers such as
>
>> n
> [1] 3000 4000 5000 3000 5000 6000 4000 5000 7000 5000 6000 7000
>
> and i'd like to set up a loop that will keep track of the number of
> occurences of each of the values that occur in the list, e.g.
>
> 3000: 2
> 4000: 2
> 5000: 4

No need for a loop, just use

table(n)



More information about the R-help mailing list