[R] How to weight cases in R

From: Raquel Guimar„es <raquelrguima_at_gmail.com>
Date: Thu, 21 Jun 2007 12:35:29 -0300


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 loghourly  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

        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch 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. Received on Thu 21 Jun 2007 - 15:46:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jun 2007 - 16:32:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.