Hello all,

I am trying to figure out how to construct several new variables without
having to write a code for each one. Specifically, I want to calculate
ratios for several variables. For instance, let's say I have:

df

male1990 male1995 male2000 male2005 female1990 female1995 female2000
female2005
10              11             15             17             15             
14               17              20
23              22             25             28             25             
22               27              30
32              33             37             36             31             
37               37              35

I want to calculate sex ratios for each of the years. Please note that this
is an example. I want to calculate age-specific ratios for 5-year age
groups, meaning that this will create a lot of variables. I am not well
versed with looping functions and would appreciate it if someone provided
some information and guidance as how to approach this.

Thanks very much!

Carlos


--
View this message in context: 
http://r.789695.n4.nabble.com/create-multiple-variables-loop-tp3672921p3672921.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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