[R] svymeans question

James Reilly reilly at stat.auckland.ac.nz
Tue Aug 26 23:39:45 CEST 2008

On 26/8/08 9:40 AM, Doran, Harold wrote:
> Computing the mean of the item by itself with svymeans agrees with the
> sample mean
>> mean(lower_dat$W524787, na.rm=T)
> [1] 0.8555471
> Compare this to the value in the row 9 up from the bottom to see it is
> different.

You might be omitting more cases due to missing values than you expect.
Does the following calculation give you the same results as in rr1?

mean( lower_dat$W524787[ apply( lower_dat[lset], 1,
     function(x) !any(is.na(x)) ) ] )

James Reilly
Department of Statistics, University of Auckland
Private Bag 92019, Auckland, New Zealand

More information about the R-help mailing list