[R] keep average values and delete duplicate rows

fuckecon iamstanhu at gmail.com
Sun Oct 28 05:16:02 CET 2012

Hello experts,

I am sorry that my subject line is confusing, because I am confused as nuts.
Let me take a shot at explaining what I am trying to do.

I have a data set of log GDP, education, democracy index, and a whole bunch
of variables for every country from 1950 to  2000. Each country accounts for
10 observations with each observation representing the mean GDP for each 5
year interval.


Country  log GDP yr
Canada	9.115211 1950
Canada	9.205848 1955
Canada	9.247975 1960
Canada	9.429002 1965
Canada	9.554069 1970
Canada	9.719351 1975
Canada	9.851376 1980
Canada	9.937892 1985
Canada	10.01457 1990
Canada	10.04093 1995
Canada	10.20005 2000
USA       9.27824    1950
USA       9.38968    1955
USA       9.415136  1960
USA       9.594625  1965
USA       9.70207    1970
USA       9.800418  1975
USA       9.96813    1980
USA       10.07001  1985
USA       10.18331  1990
USA       10.25446  1995
USA       10.4131    2000

For log GDP:

I want to create a new object in R with one line for each country and  the
average log GDP from the 10 5yr interval observations. With the subset I
want to then create a table with 3 columns and 4 rows.

(I have no idea how to write the codes to create the new object. Friend said
something about conditional median.)

1) All countries
2) High income countries
3) Low income countries

1) Democracy index
2) Log GDP
3) Obs
4) Countries

To create a high and low income columns, I am using the median as the
boundary. (i.e. high income for gdp > median of the mean for each country,
low income for gdp <= median of the mean for each country.)

I hope someone can understand what I am writing here and help me out with

Thanks so much!

View this message in context: http://r.789695.n4.nabble.com/keep-average-values-and-delete-duplicate-rows-tp4647677.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list