Displaying 1 result from an estimated 1 matches for "row_median".
2008 Sep 12
2
Finding a vector position using names rather than values
...quently need to be able to identify the rank of certain values by searching for their row names. See this mock example:
> dframe <- data.frame("Col1"=c(10,20,30), "Col2"=c(2,4,6), "Col3"=c(5,10,7), row.names=c("R1","R2","R3"))
> row_median<-apply(dframe,1,median)
> row_median.sorted <- sort(row_median, decreasing=TRUE)
> row_median.sorted
R2 R3 R1
10 7 5
I now want to know the rank of, say R3 in this vector. I know I can use match() to find this using the vector values, however I need to use the header names (eg. &...