[R] counting strings in a column
Clint Bowman
clint at ecy.wa.gov
Thu Feb 19 17:55:40 CET 2009
Try:
a<-c("o","o","a","a","g","o","a","p")
table(a)
a
a g o p
3 1 3 1
Clint Bowman INTERNET: clint at ecy.wa.gov
Air Dispersion Modeler INTERNET: clint at math.utah.edu
Air Quality Program VOICE: (360) 407-6815
Department of Ecology FAX: (360) 407-7534
USPS: PO Box 47600, Olympia, WA 98504-7600
Parcels: 300 Desmond Drive, Lacey, WA 98503-1274
On Thu, 19 Feb 2009, Nattu wrote:
> Dear All,
>
> I have a query : what is the command to count number of repeated words in a
> column.
>
> for ex:
>
> a =
>
> oranges
> oranges
> apples
> apples
> grape
> oranges
> apple
> pine
>
>
> the result should be
> oranges 3
> apples 3
> grape 1
> pine 1
>
> is there an easy way for this.
>
> Thanks,
> Nataraju
> GM R & D
> Bangalore
>
> --
> "No relationship is Static .. You either Step up or Step down"
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list