Hi,

I'm having some problems with the aggregate() function in the {stats} package, and the documentation doesn't address them.

1) Why would the first line work, but the second not? According to the help file, it accepts a "data=" argument.

 with(tsrc, aggregate(x=DistRatio, by=list(Condition), FUN=mean))
    Group.1        x
1 Congruent 1.741789
2  Mismatch 1.771425

 aggregate(x=DistRatio, by=list(Condition), data=tsrc, FUN=mean)
Error in aggregate(x = DistRatio, by = list(Condition), data = tsrc, FUN = 
mean) :
  object 'DistRatio' not found


2) The subset argument also does not appear to work (perhaps this is the same issue?):

 with(tsrc, aggregate(x=DistRatio, by=list(Condition), subset=Drop!="Yes", 
FUN=mean))
    Group.1        x
1 Congruent 1.741789
2  Mismatch 1.771425

 with(tsrc[tsrc$Drop!="Yes",], aggregate(x=DistRatio, by=list(Condition), 
FUN=mean))
    Group.1        x
1 Congruent 1.700215
2  Mismatch 1.859795


So, am I doing something wrong or is this function just not working as advertised?

Thanks,

Jon

--
Jon Zadra
Department of Psychology
University of Virginia
P.O. Box 400400
Charlottesville VA 22904
(434) 982-4744
email: za...@virginia.edu
<http://www.google.com/calendar/embed?src=jzadra%40gmail.com>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to