Hello togehter, i have a data.frame, with value like this:
A B
1 10-1 aaa
2 10-1 bbb
3 10-1 abc
4 10-2 vvv
5 10-3 ggg
I want now a evaluation, which character is how often in my data.frame. Like
this one:
A B
1 10-1 3
2 10-2 1
3 10-3
Hello,
Try the following.
dat - read.table(text =
A B
1 10-1 aaa
2 10-1 bbb
3 10-1 abc
4 10-2 vvv
5 10-3 ggg
, header = TRUE)
tbl - table(dat$A)
data.frame(tbl)
Hope this helps,
Rui Barradas
Em 10-12-2012 08:50, Mat escreveu:
Hello togehter, i have a
Professor of Anthropology
Texas AM University
College Station, TX 77843-4352
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Mat
Sent: Monday, December 10, 2012 2:50 AM
To: r-help@r-project.org
Subject: [R] Count cell Count
Thank you all, a few ideas worked perfectly for me.
I take with(dat1,aggregate(B,by=list(A=A),length)) for my task.
Have a nice day.
Mat
--
View this message in context:
http://r.789695.n4.nabble.com/Count-cell-Count-by-her-frequency-tp4652650p4652678.html
Sent from the R help mailing
...@fnt.de; r-help@r-project.org
Sent: Monday, December 10, 2012 7:43 AM
Subject: Re: [R] Count cell Count by her frequency
You request is not completely clear. I am assuming you want to count the
number of different characters in B for each category in A:
A - c(10-1, 10-1, 10-1, 10-2, 10-3)
B - c(aaa
Carrillo [mailto:mazatlanmex...@yahoo.com]
Sent: Monday, December 10, 2012 10:05 AM
To: dcarl...@tamu.edu; 'Mat'; r-help@r-project.org
Subject: Re: [R] Count cell Count by her frequency
And another way:
library(plyr)
ddply(dta,A,summarise,B=length(B))
Felipe D. Carrillo
Supervisory Fishery
6 matches
Mail list logo