The problem is that I received a large text file. Let it be
a=c("atcgatcgatcgatcgatcgatcgatcgatcgatcg")
I need to compare every third character in this text with a value (like 'c' ), and if true, I want to add 1 to counter i . I thought to use grep , but it seems that this function will not be used for my purpose. So I need your help or advice.
Moreover, I want to extract certain values ββfrom this string into a vector. For example, I want to extract 4:10 characters, for example.
a=c("atcgatcgatcgatcgatcgatcgatcgatcgatcg") [1] "gatcgatcga"
Thanks in advance.
PS
I know that this is not the best idea to write a script I need in R, but I'm curious if I can write it accordingly.
source share