user9307427
user9307427

Reputation:

RStudio: how to find and extract max value?

Say I have the dataframe df.df and I want to find the highest value.

Molly 290
Susan 189
Zoe 276
...

if I use

max(df.df)

it'll give me

[1] Zoe

But I want to extract "290". What command would I use to do so? Thanks!

Upvotes: 0

Views: 1311

Answers (1)

Hasan Jafarov
Hasan Jafarov

Reputation: 628

df <- read.table( text = "Molly 290
Susan 189
Zoe 276")
max(df[2]) #Column 2

Upvotes: 1

Related Questions