I have a vector called
vec <- c("16S_s95_S112_R2_101.fastq.gz",
"16S_s95_S112_R1_001.fastq.gz",
"16S_s94_S103_R2_021.fastq.gz",
"16S_s94_S103_R1_001.fastq.gz")
I want to grepl items with sample <- "_s95_"
and R1 <- "R1"
.
I want to use sample
and R1
objects while doing grepl and find something matching _s95_
and R1
strings both.
Result I want is 16S_s95_S112_R1_001.fastq.gz
.
I tried grepl(pattern = sample&R1, x= vec)
which did not work for me.
I can do this with multiple grepl's, but I am trying to find something neat to do this.