x <- matrix(c(1,2,3,4), nrow=2, ncol=2)
colnames(x) <- c('a','b')
rownames(x) <- c('c','d')
How do I find the column index/name and row index/name of the minimum value?
I've tried which.min, but I need to get the row/column index rather than the element. Any ideas?
This is a feed of questions about R from StackOverflow.com. Follow the link at the bottom of each question to find answers from StackOverflow.com users.
StackOverflow user contributions are licensed under cc-wiki with attribution required.
inside-R.org is a collection of resources about the open-source R Project for the R Statistics Community. This site is sponsored by Revolution Analytics.
Follow @inside_R on Twitter for updates about this site.
If you have questions or ideas for the site, please send us an email at community@inside-R.org.