Post in plain text Use grepl
On May 26, 2021 9:29:10 PM PDT, Kai Yang via R-help <r-help@r-project.org> wrote: >Hi List, >I wrote the code to create a new variable: >CRC$MMR.gene<-ifelse(grep("MLH1"|"MSH2",CRC$gene.all,value=T),"Yes","No") > > >I need to create MMR.gene column in CRC data frame, ifgene.all column >contenes MLH1 or MSH2, then the MMR.gene=Yes, if not,MMR.gene=No > >But, the code doesn't work for me. Can anyone tell how to fix the code? > >Thank you, > >Kai > [[alternative HTML version deleted]] > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.