This one seems to have slipped through the cracks, but I'll take a stab at
it:
I don't think there's an (easy) general solution but there are two
direct
ways to get at the idea.
If you are generally only seeking to do things like: x[order(x)] would
sort(x) work for you?
More generally, this can be done in not so hard a fashion with a function
wrapper:
e.g.,
# Not tested...
RecFunc <- function(df, FUN) {
df[FUN(df),]
}
so your code would look something like
RecFunc(aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean)),order)
Does this do what you were looking for?
Michael Weylandt
On Tue, Sep 13, 2011 at 12:36 PM, Benjamin Polidore
<polidore@gmail.com>wrote:
> If I create an aggregation like this:
>
> aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean)
>
> I'll get a new data frame, which I can order if I assign it like this:
>
> newFrame <- aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean)
> newFrame[order(newFrame$TEMP),]
>
> But.. if I just want to do this in one statement, what can I do? If this
> was perl, I'd be using something like $_:
>
>
>
aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean)[order($_$TEMP),]
>
> So basically, I want to call order within the square braces, and I want to
> reference the dataframe that preceeds the square brace. Is there a way to
> do this in R?
>
> thanks,
> bp
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
[[alternative HTML version deleted]]