I apologize up front if this has been covered elsewhere - but I can't find
any such question.

I have a data set that contains academic data: term (i.e., semester),
student id, dept, class, success (1=Y, 0=N)

I want to look at dept by term to determine descriptive statistics for
success to failure ratios. The intent being to discover if there are
departments that contribute significantly to the Simpson Paradox, that is,
that make overall success/failure rates undependable.

It's easy to use ftable to get the counts for what I need (row names dept
and success, col name success.  So I get something that looks like this:

             Term      1st   2nd    3rd    4th    5th
dept success                                        
AAA  0               155    240    163    286    293
          1               424    570    349    582    429
AAB  0                55      64    103       46    109
         1               122    117    145    112    145
AAC  0                11         3        4         4         4
          1                19       12      23       11        7

How can I calculate percentages by dept so that I get

AAA 0         27  ....
         1         73  ....
AAB 0        ...

Part of my lack of understanding is that I don't see a way to get the dept
(by term) totals into a data structure that I can use to calculate the
percentages. I can write procedural code to do this but is there some r-way
that would be better?

--
View this message in context: 
http://r.789695.n4.nabble.com/categorical-analysis-grouping-rows-tp4629503.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.

Reply via email to