Displaying 1 result from an estimated 1 matches for "partyid3".
Did you mean:
partyid
2012 Jul 24
1
Function for ddply
...to R and just beginning to learn to write functions. I
know I'm out of my depth posting here, and I'm sure my issue is mundane.
But here goes. I'm analyzing the American National Election Study (nes),
looking at mean values of a numeric dep_var (environ.therm) across values
of a factor (partyid3). I use ddply from plyr and wtd.mean from Hmisc. The
nes requires a weight var (wt). I use Rcmdr's plotMeans to obtain a line
chart. The following code works:
attach(nes)
obj1 = ddply(nes, .(partyid3), summarise,
var = wtd.mean(environ.therm, wt))
print(obj1)
plotMeans(obj1$var, obj1$partyid...