Hi there, I would like to extract taxa with 2 highest values, and extract those taxa from each group.
this is my data;
 data <- data.frame(group = rep(letters[1:3], each = 5),   
               value = rnorm(15),
               taxa = rep(make.unique(rep("taxa", 5)), 3))
Let's say 2 highest values correspond taxa are this two taxa.3 and taxa.
I would like to get this filtered data frame.
group    value        taxa
a        1.751479     taxa.3
a        1.75147938   taxa
b        1.47821190   taxa.3
b       -1.11304957   taxa
c       -0.72801722   taxa.3
c        0.15334196   taxa
Any help much appreciated!
thanks, for you reply, but it gives two maximum values for each group. In case of mine, I want to find two maximum values for whole data and then extract correspond taxa from each group.