Skip to content

data frame to frequencies

3 messages · cassiorx, R. Michael Weylandt, David Winsemius

#
I have a data frame that has columns Semester, Student ID (SID), Subject,
Grade, Devel (Tor F). Students can have multiple records within a semester.
Right now, the columns are not considered factors. 

I want to do an analysis that would show the number of students who received
particular combinations of grades. I also need to distinguish between the
two Development levels (they modify classes, not students), but first things
first.
                                                        Grade
Semester      Count            A   B   C   D   F other
S1                         17               1    2    0   0   0    0
                             49                1    1    1   0   0    0
                            112               0   0    0   0   0    2
                                     etc.

I can do this procedurally but that leads to a life of trouble and ugly
code. Your help deeply appreciated to do this in a r way.


--
View this message in context: http://r.789695.n4.nabble.com/data-frame-to-frequencies-tp4631859.html
Sent from the R help mailing list archive at Nabble.com.
#
I think you're looking for xtabs [see the examples; they're quite
good] but I can't be sure: your printed object can't really exist in R
so I'm not sure what you have currently.

Michael
On Wed, May 30, 2012 at 3:25 PM, cassiorx <cassiodorus at hotmail.com> wrote:
#
On May 30, 2012, at 4:51 PM, R. Michael Weylandt wrote:

            
The R way?  The "R way" would be to post directly to the mailing list  
and avoid formatted input. Best practice would be to post the output  
from dput(yourtable).

You can use merge() if you have two related tables.