On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <www...@gmail.com>wrote:

> Its because '[[' accept only element, so you need use '[':
>
> q[crossRsorted[,1]]
>
>
Henrique,

I figured out what q[crossRsorted[,1]] does - it produces q[i] for all i in
crossRsorted[,1]. Ok. Since a given index 'k' of q[[k]] can occur in
multiple rows in crossRsorted[,1], this is not what I want.

Meanwhile, I was able to express what I do want like so:

crossRsorted[Filter(function (idx) mean(q[[idx]], na.rm = TRUE),
unique(crossRsorted[,1])), ]

but, I'm afraid, that's not really "R style."  Or is it?  But perhaps the
only way?

I think I'm starting to see the allure of R: every indexing task ends up a
challenging puzzle.
Which prevents Alzheimer's [1].

 - Godmar

[1] http://www.timesonline.co.uk/tol/life_and_style/article508785.ece

        [[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.

Reply via email to