Find a row in a table if the value is known in R -


i analyzing table of thousands of genes in r. every gene row , has corresponding mrna expression values. within these values, asked find max expression values out of entries, did using max() function. returned maximum expression value, not corresponding row (gene name). does know how find unknown row known value in table?

to find location of maximum value, can use which.max() function.

more generally, if want location of element meets criteria, can use extract operator [ , perform equality test. e.g. data.frame dat:

which(dat == max(dat), arr.ind = true) 

this return array index in maximum value resides. can change condition anything, same effect.

for more info on subsetting data using extract, refer files ?'['.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -