Dear R-helpers,

I have a data.frame (bcpe.lat.m) containing 13 countries, ages 0-50yrs per 
month, and the corresponding mu&sigma (see below).

*        I would like to limit the age range to include all 12 months for the 
1st 5 years and only whole years for all ages thereafter for each of the 
countries present in the data frame.

*        I would like to create separate data.frames according to the country 
the data is from (Bolivia.bcpe.lat.m, brazil.bcpe.lat.m, etc)


I have tried using:  c(seq(0,5,1/12),seq(5,50,1) )  to select the desired ages 
but am unsure how to repeat that sequence for consecutive countries.
I have tried using: split(bcpe.lat.m, bcpe.lat.m$country) But end up with a 
string which I am no longer to select the specific ages I want and all the data 
still remains in one  variable
Have also looked a 'by', 'apply' and things like 'for (i in 1:13)'

Help with either or both steps would be greatly appreciated.

Greetings from Formentera,
Daniel

           Age(yrs) country       mu     sigma
1   0.00000000   Bolivia 11.42168 0.1014872
2   0.08333333   Bolivia 11.33625 0.1053837
3   0.16666667   Bolivia 11.28417 0.1070594
4   0.25000000   Bolivia 11.21125 0.1083872
5   0.33333333   Bolivia 11.11637 0.1095305
...
602  0.00000000  Brazil 11.54888 0.10839417
603  0.08333333  Brazil 11.46345 0.11255592
604  0.16666667  Brazil 11.41137 0.11434565
605  0.25000000  Brazil 11.33844 0.11576378
606  0.33333333  Brazil 11.24357 0.11698489
...


        [[alternative HTML version deleted]]

______________________________________________
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