Re: [R] write a loop for tallies

From: Peter Langfelder <peter.langfelder_at_gmail.com>
Date: Thu, 24 Jun 2010 15:19:49 -0700

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)



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Jun 2010 - 22:25:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jun 2010 - 22:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive