Hi,

I am quite new to R (but like it very much!), so please apologize if 
this is a too simple question.

I have a large data frame consisting of data from a survey. There is, 
for example, information about age and education (a numeric value from 
1-9). Now I would like to extract the total amount of each type of 
education within different age groups (e.g. from 18 to 25, from 25 to 
35 etc.). How could I achieve this? (I have been thinking about 
using 'subset', but if there are better ideas they are welcome :) )

An example might clarify my point. Let's assume the following data:
#       age     edu
1       25      2
2       33      5
3       22      3
4       19      1
5       21      3
6       30      4
7       32      4
8       31      1

What I want to have is:

edu     18-25   25-35 ...
1       1       1
2       1       0
3       2       0
4       0       2
5       0       1

Thanks in advance & kind regards,
Kimmo

______________________________________________
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