I'm very new to R. I hope that some one can help me with this one. I have a data.frame
, which looks for example like this:
Year month d class
2009 200901 1 a
2009 200901 1 b
2009 200902 2 a
2009 200902 1 b
2009 200902 1 c
2009 200903 5 a
2009 200903 1 b
2009 200903 1 c
2009 200903 3 a
2010 201001 1 a
2010 201001 4 b
2010 201002 1 a
2010 201002 7 b
2010 201002 1 c
2010 201003 2 a
2010 201003 4 b
2010 201003 2 c
2010 201003 1 a
I would like to make a cross table out of them and the result would look like this
Year a b c
2009 3.667 1 0.667
2010 1.667 5 1
First I would like to summary all the data for each month per class and then taking the average over all those month to have the number per year for each class.
Thanks a lot.