[R] using aggregate with survey-design and survey functions

Spencer Graves spencer.graves at pdf.com
Sat Sep 20 04:47:38 CEST 2003


What do you get from the following: 

      is.element("income", objects())

spencer graves

TyagiAnupam at aol.com wrote:

>Hi R users,
>
>I am trying to use the aggregate function with a survey design object and 
>survey functions, but get the following error. I think I am incorrectly using the 
>syntax somehow, and it may not be possible to access variables directly by 
>name in a survey-design object. Am I right? How do I fix this problem? I have 
>used aggregate with "mean" and "weighted.mean", and that works fine. I am trying 
>to find out where the difference is. What would be an efficient alternative 
>to aggregate for a large dataset?
>
>  
>
>>s <- aggregate(income,list(age,sex),function(x) (svymean(~x,design=d.na)))
>>    
>>
>Error in aggregate(income, list(age, sex), function(x) (svymean(~x,  : 
>    Object "income" not found
> 
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list