[R] How to calculate words in column?

Edwin Sendjaja edwin7 at web.de
Sat Dec 6 17:30:29 CET 2008


Hi,

I have a table for an 1 week exam result for many classes in school, like 
this:

       Day       Class_ID  Test    Result
1   Monday    1                  Paper Passed 
2   Tuesday    1                  Oral   Passed
3   Friday       1                  Paper  Passed
4   Monday    3                  Paper Passed
5   Sunday     3                  Oral   Passed
6   Monday    3                  Paper Passed
6   Sunday     3                  Paper Passed

How can I sum the Word "Passed" from Result column ( for earch Class_ID and 
each Test), so i can get this following table:


     Class_ID  Test          Passed_Count          
1     1            Paper           2 
2     1            Oral             1
3     3            Oral             1
4     3            Paper           3


Passed_Count column is just the Value, how many people passed the exam. In the 
tabell, they are 2 people passed the paper test (Result=Passed).


I hope someone can help me, Or maybe there is an example that i can see.


Thank you in advance



More information about the R-help mailing list