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

Spencer Graves spencer.graves at pdf.com
Sat Sep 20 11:42:26 CEST 2003


In the following command: 

    s <- aggregate(income,list(age,sex),function(x) 
(svymean(~x,design=d.na)))

Since 'is.element("income", objects())' was FALSE, it was not in the 
search path, which it must be for "aggregate" to find it.  I suggest you 
read or reread something like "An Introduction to R", downloadable from 
"www.r-project.org" -> "Manuals". 

hope this helps. 
spencer graves

TyagiAnupam at aol.com wrote:

>In a message dated 9/19/03 7:46:07 PM Pacific Daylight Time, 
>spencer.graves at pdf.com writes:
>
>  
>
>>What do you get from the following: 
>>
>>   is.element("income", objects())
>>
>>spencer graves
>>
>>    
>>
>
>  
>
>>is.element("income", objects())
>>    
>>
>[1] FALSE
>
>The following may give further info about why I am getting this. Design 
>object is "d.na"
>
>  
>
>>attributes(d.na)
>>    
>>
>$names
>[1] "cluster"   "strata"    "prob"      "allprob"   "call"      "variables"
>[7] "nPSU"     
>
>$class
>[1] "survey.design"
>
>	[[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