On Fri, 19 Sep 2003 [EMAIL PROTECTED] 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
This isn't going to work.
svymean needs the survey metadata to get the right mean, and aggregate
doesn't give it enough information. aggregate would need a separate
method for svydesign objects.
-thomas
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help