Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Great! This is exactly what I was locking for! Thank you very much, arun. Best wishes Alain > arun hat am 5. August 2014 um 16:47 geschrieben: > > > You could try: > lv <- levels(unique(unlist(df))) > as.data.frame(t(apply(df, 2, function(x) table(factor(x, levels=lv) > + - 0 > i1 10

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread arun
You could try: lv <- levels(unique(unlist(df))) as.data.frame(t(apply(df, 2, function(x) table(factor(x, levels=lv)     +  - 0 i1 10  0 0 i2 10  0 0 i3  0 10 0 i4  0  9 1 i5 10  0 0 i6  1  9 0 i7  9  0 1 i8  4  2 4 i9  7  1 2 A.K. On Tuesday, August 5, 2014 5:36 AM, Alain D. wrote: Dear R-

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Thank you Jim, this is a good step in the right direction. But is there also a way to get the output in a nice dataframe with VAR1 to VAR 1 to 9 as rows? Best wishes Alain > Jim Lemon hat am 5. August 2014 um 14:35 geschrieben: > > > On Tue, 5 Aug 2014 11:36:36 AM Alain D. wrote: > > Dear R-Li

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Jim Lemon
On Tue, 5 Aug 2014 11:36:36 AM Alain D. wrote: > Dear R-List, > > I want to have descriptive stats in a special form and cannot figure out a > nice solution. > > df<- as.data.frame(cbind(i1=rep("+"),i2=rep("+",10),i3=rep("-",10),i4=c(rep(" > -",2),"0",rep("-",7)),i5=rep("+",10),i6=c(rep("-",9),