[R] Count variables by ID

travelmail travelmail26 at gmail.com
Wed Feb 10 23:58:18 CET 2010


Hello,

I have an education dataset and I'd like to know how to count the number of
courses each student has taken in a particular subject. For instance, say
the course codes for "History" are 20-26 & 31 and I have the following data

Student ID  	Course Code
1	                16
1	                17
1	                21
1	                31

2	                10
2	                22
2	                23
2	                24


I would like a separate variable that reads like this
Student ID    Hist Courses
1                  2
2                  3

I've read other "count" tutorials on the forum, but couldn't still find an
answer to my problem. Thanks for helping out!

Greg
-- 
View this message in context: http://n4.nabble.com/Count-variables-by-ID-tp1476618p1476618.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list