I have the following data:
library(tidyverse)
df1 <- tibble(
title = c("AA", "AA", "AA", "B", "C", "D", "D"),
rate = c(100, 100, 100, 95, 92, 90, 90),
name = c("G", "N", "E", "T", "O", "W", "L"),
pos = c(10, 1, 2, 2, 3, 5, 4)
)
title rate name pos
<chr> <dbl> <chr> <dbl>
AA 100 G 10
AA 100 N 1
AA 100 E 2
B 95 T 2
C 92 O 3
D 90 W 5
D 90 L 4
I want to find out at every title which name has the biggest pos value.
So, for title AA, it would be G, for title B, it would be T, for title C it would be O and for title D it would be W.