Currently I'm working with some Fastq sequencing data. I have a dataframe with three columns and hundreds of rows. The first column contains the raw sequencing reads and the others contain information about those reads. I want to return a row with the string "FALSE" in the 3rd column, plus the row directly above this, and two rows directly below it. I think it is similar to grep -A -B in shell.
I've looked around and my question is very similar to this one:
Returning above and below rows of specific rows in r dataframe
However, the answers here are based on row-names and not strings within the rows. My row names are just numbers in numerical order.
Fastq Output BARCODE Dulplicated
1 ReadName1 NA NA
2 ReadSeq1 TGTG TTAT FALSE
3 + NA NA
4 Ascii_score1 NA NA
5 ReadName2 NA NA
6 ReadSeq2 TGCT TTAT FALSE
7 + NA NA
8 Ascii_score2 NA NA
9 ReadName3 NA NA
10 ReadSeq3 TGCT TTAT TRUE
11 + NA NA
12 Ascii_score3 NA NA