Given a data frame df with columns d, c, v. How do I find the value of d for the maximum value of v among the subset of records where c == "foo"?
I tried this:
df[df$v==max(df$v) & df$c == "foo","d"]
But I got:
character(0)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yo can do as follows:
EDITED:
If you want to get the value of
dfor all the levels ofc: