df <- data.frame(ID = rep(c("WTN", "KON", "WTH","KOH"), each = 3),
Time = rep(c("A", "B", "C"), times = 4),
replicate(3,sample(1:100,12,rep=TRUE)))
我想根据同一行的两个不同列的值选择一行,在本例中为“WTN”和“A”。预期产出:
1 WTN A 84 96 26
答案 0 :(得分:0)
我们可以使用filter
dplyr
library(dplyr)
df %>%
filter(ID == "WTN" & Time == "A")