dplyr: filter returns only tibble top row

I want to find the tibble row which has the maximum value in the column 'cfs.'

Using which.max(pdx_disc$cfs) I learn the value is 8054. Using that value in with:
pdx_disc %>% filter(cfs == 8054)

A tibble: 0 × 9

… with 9 variables: site_nbr , year , mon , day ,

hr , min , tz , cfs , sampdt

the content of that row is not returned.

What am I doing incorrectly?

which.max returns the position (row number) of the maximum value. If you want the value, use max().

can be used to subset

pdx_disc[which.max(pdx_disc$cfs),]_

which will return all rows (with all columns in that row) that contain the maximum value of pdx_disc$cfs

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.