[Solved] Extracting Data from a list- find the highest value


I’m assuming IATA is the ticket agent variable:

df = data.frame(IATA=c(3300, 3300, 3300, 3300, 3301, 3301, 3302, 3303, 3303))
table(df$IATA)
# 3300 3301 3302 3303 
#    4    2    1    2 

As you can see, table gives the frequency of ticket sales by each ticket agent.

names(which.max(table(df$IATA)))
# [1] "3300"

If there are ties and you need all of them, try:

df = data.frame(IATA=c(3300, 3300, 3300, 3300, 3301, 3301, 3302, 3303, 3303, 3303, 3303))
names(which(table(df$IATA) == max(table(df$IATA))))
# [1] "3300" "3303"

6

solved Extracting Data from a list- find the highest value