I have the swiss data set provided by R, which has the following form:
Fertility Agriculture Examination Education Catholic Infant.Mortality
Courtelary 80.2 17.0 15 12 9.96 22.2
Delemont 83.1 45.1 6 9 84.84 22.2
Franches-Mnt 92.5 39.7 5 5 93.40 20.2
. . . . . . .
. . . . . . .
. . . . . . .
V. De Geneve 35.0 1.2 37 53 42.34 18.0
Rive Droite 44.7 46.6 16 29 50.43 18.2
Rive Gauche 42.8 27.7 22 29 58.33 19.3
And I would like to know if there is a simple or easy way to classify the data in four groups, one for each quartile of the Education variable and then get the corresponding Infant.Mortality for each province, so I can get something like:
Group1stQ Group1stQ Group1stQ Group1stQ
<Mortality for <Mortality for <Mortality for <Mortality for
1st province 1st province 1st province 1st province
on this group> on this group> on this group> on this group>
<Mortality for <Mortality for <Mortality for <Mortality for
2nd province 2nd province 2nd province 2nd province
on this group> on this group> on this group> on this group>
<Mortality for <Mortality for <Mortality for <Mortality for
3rd province 3rd province 3rd province 3rd province
on this group> on this group> on this group> on this group>
. . . .
. . . .
. . . .
Thanks in advance for your help!!!
what about:
(I don’t really know what your numbers are – they don’t coincide with the averages I get)
(That was before the edit…)
(After 2nd edit:)
If you want the Infant.Mortality for each of the provinces belongig to that quartile of Eduction, use
list ()as aggregation function:or: