[R] Creating a frequency table for binomial varaible
arun
smartpink111 at yahoo.com
Wed Nov 21 20:51:04 CET 2012
Hi,
library(plyr) #sorry, forgot about that
?count()
Anyway, Bill's solution is much easier and simple.
You can also use this:
set.seed(25)
bindat<-rbinom(20,15,0.1)
data.frame(value=0:5,freq=sapply(0:5,function(x,y=bindat) length(y[y==x])))
# value freq
#1 0 4
#2 1 7
#3 2 6
#4 3 1
#5 4 2
#6 5 0
A.K.
----- Original Message -----
From: arun4 <arun.ganesh2012 at gmail.com>
To: r-help at r-project.org
Cc:
Sent: Wednesday, November 21, 2012 10:58 AM
Subject: Re: [R] Creating a frequency table for binomial varaible
Thank you A.K
Btw in which package count() is available?
--
View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650305.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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