HI, I'm new to R and in need of some help,
Name <- c("Jon", "Bill", "Maria", "Ben", "Tina")
Age <- c(23, 41, 32, 58, 26)
Score <- c(99,42,56,84, 43)
say I have this as my data, how to I extract the name of the person with the highest score.
Thanks
FJCC
2
With the data in vectors, you could do the following
Score <- c(99,42,56,84, 43)
Name <- c("Jon", "Bill", "Maria", "Ben", "Tina")
Age <- c(23, 41, 32, 58, 26)
MaxPosition <- which.max(Score)
Name[MaxPosition]
[1] "Jon"
1 Like
system
Closed
3
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.