So if I have a data frame that looks like:
A B C
rowname1 4.5 4 3.2
rowname2 3 23 9
How do I get R to give me the name(s) of the row/columns that contain a particular number?
i.e. if I give the value 3, it gives back
rowname2,A
Assuming no duplicates, you can use
whichcombined with thearr.indargument:If you must have the actual row and column names of the location, then just index into them appropriately: