-6
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)))

I want to select a row based on the values of two different columns of the same row, in this case "WTN" and "A". Expected output:

1  WTN    A 84 96 26
Al14
  • 1,734
  • 6
  • 32
  • 55

1 Answers1

0

We can use filter from dplyr

 library(dplyr)
 df %>%
     filter(ID == "WTN" & Time == "A")
akrun
  • 874,273
  • 37
  • 540
  • 662