I understand how to sort a data frame:
df[order(df$Height),]
and I understand how to filter (or subset) a data frame matching some predicate:
df[df$Weight > 120,]
but how do I sort and filter (as an example, order by Height and filter by Weight)?
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.
Either in two steps
or if you must in one step — but it really is not any cleaner.
Data first:
And one way of doing it is double-subsetting:
I’d go with the two-step.