Reputation: 3
In SPSS I can choose a variable which I want to use for weighting other variables just by using "weights_by".
For my studies I have to use Rstudio now. When I do the above thing and open it in R, they weights will disappear. How can I do this in R then?
Something like:
"weights(pspwhgt)" (without"") is not working for me...
I'm on a totally beginner level. I have my variable gender and I want to weight it by my other variable pspwhgt. How can I do this without being a genius in math or programming?
Upvotes: 0
Views: 1487
Reputation: 44527
Unlike SPSS, weights in R are applied at the operation level rather than globally. So, how you specify and use weights depends on what operation you want to perform. Many R functions have a weights
argument (such as lm()
, etc.). You may also want weighted.mean()
, etc.
Upvotes: 1