Hi all,

As you see in the picture, I have two columns. So, I want to replace the values smaller than 0.500000 from the column A_Freq with the values in the M.F column In the same rows. What is the best idea?

for example: replace 0.312500 In the third row of the column A_Freq with 0.687500 From the same row but in the column M.F.

             CHROM_POS   A_Freq      M.F    N_Chr 
    1  CM009840.1_1096 0.812500 0.187500 16.25000 
    2  CM009840.1_1177 0.611111 0.388889 12.22222 
    3  CM009840.1_1276 0.312500 0.687500  6.25000 
    4  CM009840.1_1295 0.277778 0.722222  5.55556 
    5  CM009840.1_1471 0.250000 0.750000  5.00000 
    6  CM009840.1_1518 0.875000 0.125000 17.50000 
    7  CM009840.1_1527 0.222222 0.777778  4.44444 
    8  CM009840.1_1533 0.777778 0.222222 15.55556 
    9  CM009840.1_1630 0.250000 0.750000  5.00000 
    10 CM009840.1_1639 0.000000 1.000000  0.00000 
    11 CM009840.1_1711 0.500000 0.500000 10.00000 
    12 CM009840.1_1972 0.250000 0.750000  5.00000 
    13 CM009840.1_2030 0.142857 0.857143  2.85714 
    14 CM009840.1_2101 0.375000 0.625000  7.50000 
    15 CM009840.1_2690 0.687500 0.312500 13.75000 
    16 CM009840.1_2849 0.142857 0.857143  2.85714 
    17 CM009840.1_3013 0.312500 0.687500  6.25000 
    18 CM009840.1_3042 0.714286 0.285714 14.28572 
    19 CM009840.1_3062 0.250000 0.750000  5.00000 
    20 CM009840.1_3128 0.250000 0.750000  5.00000 


Best Regard

Modtafa
with R :

    select <- df$A_Freq < 0.5
    df[select,"A_Freq"] <- df[select,"M.F"]

or maybe more elegant : 

    df$A_Freq <- ifelse(df$A_Freq < 0.5, df$M.F, df$A_Freq)