在R中查找列的同步

时间:2016-05-01 00:34:29

标签: r

数据

    v1 <- c(52.9799999999814, 53.4200000000128, 52.0899999999965, 57.9700000000012, 
    60.679999999993, 0.300000000017462, 1.76999999998952, 61.1900000000023, 
    58.9599999999919, 1.73000000001048, 0.269999999989523, 6.92000000001281, 
    60.5299999999988, 60.859999999986, 59.5599999999977, 61.0600000000268, 
    60.6299999999756, 60.9700000000012, 60.1600000000035, 60.4599999999919, 
    60.0900000000256)

    v2 <- c(52.679999999993, 53.140000000014, 52.8899999999849, 57.6700000000128, 
    60.5199999999895, 2.04000000000815, 61.890000000014, 59.5699999999779, 
    2.05999999999767, 6.98000000001048, 60.7399999999907, 60.7799999999988, 
    59.7300000000105, 60.9100000000035, 60.3299999999872, 60.5500000000175, 
    60.6600000000035, 60.3499999999767, 60.7300000000105, 60.6700000000128, 
    60.3799999999756)

tv3 <- data.frame(v1,v2)


    tv3$v5 <- tv3$v2 - tv3$v1
    tv3$v5
     [1]  -0.30  -0.28   0.80  -0.30  -0.16   1.74  60.12  -1.62 -56.90   5.25  60.47  53.86  -0.80
    [14]   0.05   0.77  -0.51   0.03  -0.62   0.57   0.21   0.29

所以你看,差异应该保持较小,如果它更大,就像在这种情况下,在特定行,它会得到60.

所以基本上如果我们只删除V1中的0.30行并将其移动一个单元格,差异就不会高达60。 所以0.30是噪音值,这是我必须要想的并把它放在V3

我想要的结果如下。

    v1       v2     V3
    52.98   52.68   0.3
    53.42   53.14   0.27
    52.09   52.89   
    57.97   57.67   
    60.68   60.52   
    1.77    2.04    
    61.19   61.89   
    58.96   59.57   
    1.73    2.06    
    6.92    6.98    
    60.53   60.74   
    60.86   60.78   
    59.56   59.73   
    61.06   60.91   
    60.63   60.33   
    60.97   60.55   
    60.16   60.66   
    60.46   60.35   
    60.09   60.73   

请注意,所有列的序列似乎只与几个点的差异同步。

可能是我的情况需要实施Needleman-Wunsch Algo

0 个答案:

没有答案