Utility function to combine duplicate peaks in peak table, i.e. peaks that
were integrated at more than one wavelength or component. Specify tolerance
(tol
) for retention time matching and minimum spectral correlation
(min.cor
) for a match.
Usage
combine_peaks(
peak_table,
tol = 0.01,
min.cor = 0.9,
choose = "max",
verbose = getOption("verbose")
)
Arguments
- peak_table
Peak table from
get_peaktable
.- tol
Tolerance for matching retention times (maximum retention time difference). Defaults to
.01
.- min.cor
Minimum spectral correlation to confirm a match. Defaults to
0.9
.- choose
If
max
will retain peak with highest intensity. Otherwise, the first column in the data.frame will be retained.- verbose
Logical. Whether to print status to the console.
Value
A peak table similar to the input peak table, but with duplicate columns combined according to the specified criteria.
Examples
data(pk_tab)
data(Sa_warp)
pk_tab <- attach_ref_spectra(pk_tab)
combine_peaks(pk_tab, tol = .02, min.cor = .9)
#> V1 V2 V3 V4 V5 V6 V7
#> 119 547.5999 0.00000 64.73611 188.9210 1514.4775 31.08266 7972.271
#> 121 426.2768 109.41736 61.30032 0.0000 800.6312 0.00000 5742.089
#> 122 839.5934 94.67302 199.57845 0.0000 2595.0200 179.59510 5966.168
#> 458 620.1729 228.73095 198.89770 530.8515 1399.5000 28.75473 10987.963
#> V8 V9 V10 V11 V12 V13 V14 V15
#> 119 241.2644 4141.194 158.2482 147.14305 228.2495 3616.648 1406.7510 3251.616
#> 121 94.9273 1811.813 0.0000 81.06425 758.0809 1998.574 849.7337 2209.005
#> 122 136.7419 3567.244 0.0000 112.02525 402.7496 3061.476 1147.1180 2717.260
#> 458 362.4412 3319.526 346.4913 312.67651 539.1735 4205.752 2360.5469 2455.022
#> V16 V17 V18 V19 V20 V21 V22 V23
#> 119 0.00000 343.0051 296.6922 113.243756 1147.1798 1384.080 220.73047 0.000000
#> 121 0.00000 101.5689 161.9159 8.007096 656.8275 1189.811 83.93586 5.515938
#> 122 79.15089 159.8489 244.1269 36.488943 795.4071 1427.085 275.36463 5.266083
#> 458 42.90218 445.4984 454.3478 16.246979 1202.3318 1478.686 229.99456 2.937198
#> V24 V25 V26 V27 V28 V29 V30 V31
#> 119 0.7932897 15.283759 1703.289 156.39972 0.00000 49.41934 32.37732 71.26704
#> 121 0.0000000 41.785287 1365.711 34.63006 18.39123 14.90621 15.30085 28.80203
#> 122 0.0000000 11.908741 1589.343 71.47440 37.85030 19.71575 20.80656 23.50600
#> 458 3.5934152 2.675703 2324.971 47.70708 26.21671 41.10378 28.37305 13.11958
#> V32 V33 V34 V35 V36 V37 V38 V39
#> 119 18.098750 34.32758 24.20533 0.00000 40.94460 66.63341 1.560411 628.8432
#> 121 0.000000 25.78324 0.00000 0.00000 58.29037 35.70237 0.000000 313.3893
#> 122 4.146413 88.99537 0.00000 17.72865 63.09756 40.62970 30.633681 1083.3709
#> 458 21.856280 39.24938 0.00000 30.85831 80.37326 77.24610 134.060160 634.5378
#> V40 V41 V45 V50 V51 V52 V57 V58
#> 119 5.954668 3.185244 26.855908 1594.504 181.23686 68.35036 0.000000 6.765074
#> 121 0.000000 17.384465 4.328725 1107.869 46.57830 34.55536 1.169725 3.267406
#> 122 34.168541 0.000000 2.934368 1369.448 94.47697 88.13190 1.348439 4.906127
#> 458 0.000000 5.334132 58.508031 1217.711 254.76091 97.89059 4.839070 1.766295
#> V60 V61 V62 V67
#> 119 10.825399 5.025003 2.659547 9.931884
#> 121 5.880129 0.000000 6.603921 7.197999
#> 122 14.487687 2.717955 2.681821 19.382161
#> 458 11.990751 6.853318 8.433412 21.058001