I got a data frame like in an example and I would select all values all IDs and all of the values from that ID when the condition is met. Condition, in this case, would be that path must contain "one".
df <- data.frame(id=c(1, 1, 1, 2, 2, 2, 3, 3, 3),
path=c("one", "two", "three", "four", "oned", "five", "six",
"seven", "eight"))
Expected result:
result <- data.frame(id=c(1, 1, 1, 2, 2, 2),
path=c("one", "two", "three", "four", "oned", "five"))
What is the most elegant way of doing this?