I have a set of survey design data for each quarter/year in RDs format on my disk. The data is like this:
Year Quarter Age
2010 1 27
2010 1 32
2010 1 34
...
I'm using the function svymean(formula=~Age, na.rm = T, design = data20101)
to estimate the mean of the age variable for each year/quarter file. I would like to run this more efficiently in a way that I could run the function in a loop and then save the results in one single data frame.
The output I'm looking for is to produce such a dataframe:
Year Quarter Mean_Age
2010 1 31.1
2010 1 32.4
2010 1 30.9
2010 1 34.5
2010 2 36.3
2010 2 31.2
2010 2 30.8
2010 2 35.6
...
Regards,