dear all
Good evening
i have data like this
now i would like select rows matching to my condition in any of ID1 and ID2 or both of ID1 and ID2 cond <- c("A/T","A/G","A/C","T/A","T/G","T/C","G/A","G/T","G/C","C/A","C/T","C/G","MISSING) and also want to select column containing same letter for example SNP1 having A/A in ID1 and ID2. Now i would like to get selected all the SNPs from my data except SNP2 as my result. i used the following code using dplyr package but not getting expected results. here is my code
library(dplyr)
test<-read.csv("myworkbook.csv")
cond <- c("A/T", "A/G", "A/C", "T/A", "T/G", "T/C", "G/A", "G/T", "G/C", "C/A", "C/T", "C/G","MISSING")
test %>% select(starts_with("SNP") & where(~ any(.x %in% cond))) ### select columns whos name starts with SNP
test1 %>% select(where(~ any(.x %in% cond)))
can anyone help me to sort out my problem, any help in this regard will be highly appreciated
Thanks in advance