Re: [R] Counting various elemnts in a vactor

2013-03-26 Thread arun
AM Subject: [R] Counting various elemnts in a vactor Dear R forum I have a vector say as given below df = c("F", "C", "F", "B", "D", "A", "D", "D", "A", "F", "D", "F", "B"

Re: [R] Counting various elemnts in a vactor

2013-03-26 Thread Katherine Gobin
Dear Sir, Thanks a lot for your great help. I couldn't have figured it out. Thanks again. Regards Katherine --- On Tue, 26/3/13, D. Rizopoulos wrote: From: D. Rizopoulos Subject: Re: [R] Counting various elemnts in a vactor To: "Katherine Gobin" Cc: "r-help@r-project

Re: [R] Counting various elemnts in a vactor

2013-03-26 Thread D. Rizopoulos
try this: df <- c("F", "C", "F", "B", "D", "A", "D", "D", "A", "F", "D", "F", "B", "C") tab <- table(df) tab rep(names(tab), 100 * tab) I hope it helps. Best, Dimitris On 3/26/2013 9:12 AM, Katherine Gobin wrote: > Dear R forum > > I have a vector say as given below > > df = c("F", "C",

[R] Counting various elemnts in a vactor

2013-03-26 Thread Katherine Gobin
Dear R forum I have a vector say as given below df = c("F", "C", "F", "B", "D", "A", "D", "D", "A", "F", "D", "F", "B",    "C") I need to find (1) how many times each element occurs? e.g. in above vector F occurs 4 times, C occurs 2 times etc. (2) Depending on the number of occurrences, I ne