user17020693
user17020693

Reputation:

How to find the maximum value (rows) from a specific section of a column?

What flower(s) had the longest petals from the year 1980-1985?

subset(Garden$Year, subset = "Year" == 1980:1985)

Upvotes: 0

Views: 38

Answers (1)

akrun
akrun

Reputation: 886938

We may subset the 'Year' with %in%, use the other column (not clear what the column name is - maybe 'petals') to subset and get the max

with(Garden, max(petals[Year %in% 1980:1985]))

subset works on a data.frame and not on a vector/column

Upvotes: 1

Related Questions