How to weight cases in R
- From: raquelrguima@xxxxxxxxx
- Date: Wed, 20 Jun 2007 14:47:59 -0000
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
.
- Follow-Ups:
- Re: How to weight cases in R
- From: John Kane
- Re: How to weight cases in R
- Prev by Date: How to compare the spectrum of reactivity of two sets of samples
- Next by Date: Re: How to weight cases in R
- Previous by thread: How to compare the spectrum of reactivity of two sets of samples
- Next by thread: Re: How to weight cases in R
- Index(es):