I have several *.txt files that look like
ID BP
Id1 A
Id2 A
Id3 T
Id4 C
Id5 A
Id6 T
Id7 A
Id8 T
I want for every ID previous 4 characters from BP and the next 2 characters of BP
something like:
Id5 A CTAA TA
Id6 T TACT AT
I am trying to achieve this by using lag and lead functions from dplyr but not able to get the output as expected.