サンプルの調査シートがあります。人口統計のようなもの。country (factor)
列の 1 つは別の列ですannual income
。ここで、各国の平均を計算し、 new data.frame
withcountry
および対応するmeanに保存する必要があります。シンプルなはずなのに迷ってしまいます。データは、次の図のようなものです。
Country Income($) Education ... ... ...
1. USA 90000 Phd
2. UK 94000 Undergrad
3. USA 94000 Highschool
4. UK 87000 Phd
5. Russia 77000 Undergrad
6. Norway 60000 Masters
7. Korea 90000 Phd
8. USA 110000 Masters
.
.
次のような最終結果が必要です。
USA UK Russia ...
98000 90000 75000
ありがとうございました。