I am beginner in R, so apologize for such a simple question
I have two columns
V1 V2 T 1 C 0 A 1
if the column V2 is 1, then I want to replace nucleotide complementary if 0 is left as is I wrote a for functiom (in my many rows of data), but after his performance I get
V1 V2 V3 T 1 NA C 0 NA A 1 T
And i want get
V1 V2 V3 T 1 T C 0 C A 1 T
where is the mistake?
whether it is possible to do it without the for, for examle using apply?