How to weight cases in R



Hi you all,

I need some help, as i'm a begginer using R. I have two objects in my
data.frame, named "homens" e "mulheres" (male and female
observations). For each of them, I have the log-hourly wages (called
logsalh). I have to create a new variable of earnings which is the log-
hourly wage weighted by a other column (called "pesop"), that is in
each data.frame (for men and women).

I've tried this commands, but it failed:

logsalhpm <-transform(mulheres$logsalh mulheres$pesop,
logsalhp=(mulheres$logsalh)*(mulheres$pesop)/sum(mulheres$pesop))

where "logsalp" is the name of the new variable of earnings, weighted.

Could somenone please help me?

Best wishes, Raquel

.