-2

I am using R for the following.

I have a simple data frame as shown by the table picture below.

enter image description here

I would like to filter it so that only the max length of each type is shown. For example, something like below:

            day_of_week     max_ride_length
member         Sat              16.97923
casual         Sun              52.60897

I have no clue where to start. Can anyone provide any help?

ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
  • Images are not the right way to share data/code. Add them in a reproducible format which is easier to copy. Read about [how to give a reproducible example](http://stackoverflow.com/questions/5963269). – Ronak Shah Jun 30 '21 at 10:21

1 Answers1

1

You can try subset + ave like below

subset(
    df,
    ave(ride_length,member_casual,FUN = max)==ride_length
)
ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81