Re: [R] conditionally weighted mean with NAs

2011-04-02 Thread Joshua Wiley
On Sat, Apr 2, 2011 at 7:59 PM, David Winsemius wrote: > > On Apr 2, 2011, at 10:20 PM, Joshua Wiley wrote: >> VA <- cbind(OS = c(.2, 0, 1, -.1, NA, 3, NA), >>  OD = c(.3, -.1, .2, -.1, NA, 0, .1), >>  Desired = c(0.225, -0.075, 0.4, -0.1, NA, 0.75, 0.1)) > >  VA <- cbind(VA, 0.75*pmin(VA[, "OS"],

Re: [R] conditionally weighted mean with NAs

2011-04-02 Thread David Winsemius
On Apr 2, 2011, at 10:20 PM, Joshua Wiley wrote: Dear List, I am trying to take the weighted average of two numbers (visual acuity measures from the left and right eye). For each row, the lowest value should get a weight of .75, and the highest a weight of .25. My problem is, if one value i