As I have to to this in a simulation study for 1000 such binomial variables, I have created a R function as below.. Am I doing in the correct way? or is there any other simplest ways?
#using a user defined function to create a frequency distribution create.freq.table<- function(x){ values<-seq(0,5,by=1) level<-seq(0,6,by=1) freq.cut<-cut(x,breaks=level,right=FALSE) int.freq.table<-table(freq.cut) int.dataframe<-data.frame(int.freq.table) final.freq.table<-data.frame(cbind(values, Freq=int.dataframe[,2])) return(final.freq.table) } -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650295.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.