Skip to contents

Extracts the UV-VIS spectrum at a specified retention time from one or more chromatograms in a chrom_list.

Usage

get_spectra(
  loc,
  peak_table,
  chrom_list = NULL,
  idx = seq_along(chrom_list),
  lambda = "max",
  scale_spectrum = FALSE,
  what = c("peak", "rt", "idx"),
  format = c("wide", "long")
)

Arguments

loc

Peak or retention time to extract the spectrum at. Interpretation depends on what.

peak_table

A peak_table object. Required if what == "peak".

chrom_list

A list of chromatographic matrices.

idx

Indices of chromatograms to extract spectra from. Defaults to all chromatograms in chrom_list.

lambda

Wavelength at which to extract the spectrum. Use "max" to select the wavelength with the highest absorbance.

scale_spectrum

Logical. Whether to normalize absorbance values to the range [0, 1]. Defaults to FALSE.

what

How to interpret loc. One of "peak" (look up retention time from peak_table), "rt" (treat loc as a retention time directly), or "idx" (treat loc as a row index).

format

One of "wide" or "long". In wide format, wavelengths are rows and each column is a sample. In long format, columns are wavelength, absorbance, sample, and rt. Defaults to "wide".

Value

A data.frame in the format specified by format.

Examples

data(pk_tab)
data(Sa_warp)
get_spectra("V10", peak_table = pk_tab)
#>           119       121       122       458
#> 200 20.465973 22.716069 11.224646 47.255257
#> 202 21.424005 22.446283 11.507905 48.246645
#> 204 21.527970 21.140819 11.061494 47.484690
#> 206 20.571022 19.049995 10.439649 44.562637
#> 208 19.025021 16.393686  9.578622 40.455370
#> 210 17.518748 13.862240  8.865667 36.157063
#> 212 15.863267 11.877911  8.255794 32.487345
#> 214 13.597520 10.637408  7.578242 29.666945
#> 216 11.304826  9.874475  7.023525 27.474777
#> 218  9.609400  9.322845  6.615194 26.028717
#> 220  8.609408  9.052127  6.409309 24.919353
#> 222  7.944950  8.744406  5.908514 23.780017
#> 224  7.354353  8.455365  5.467922 22.619708
#> 226  6.862600  8.076176  4.968394 21.040125
#> 228  6.592249  7.670881  4.616473 19.291929
#> 230  6.537753  7.260656  4.448025 17.601837
#> 232  6.615436  6.841031  4.383417 16.084660
#> 234  6.609378  6.413736  4.210250 14.597516
#> 236  6.496212  5.954024  3.940079 13.187683
#> 238  6.308369  5.470176  3.815611 12.101344
#> 240  6.020130  4.936829  3.678245 11.109262
#> 242  5.717919  4.558266  3.588815 10.333886
#> 244  5.388886  4.208295  3.570103  9.693659
#> 246  5.045720  3.913438  3.583497  9.108740
#> 248  4.687846  3.690707  3.566742  8.593859
#> 250  4.308960  3.418456  3.463683  8.228004
#> 252  3.938813  3.177047  3.279491  7.767023
#> 254  3.541993  2.967485  3.178178  7.513937
#> 256  3.148559  2.773006  3.016038  7.211275
#> 258  2.789029  2.605864  2.868743  6.971868
#> 260  2.512049  2.495786  2.725209  6.875728
#> 262  2.391232  2.454589  2.625400  6.999124
#> 264  2.369171  2.552078  2.703357  7.347819
#> 266  2.457541  2.697693  2.683674  7.819617
#> 268  2.631789  2.880504  2.807386  8.321012
#> 270  2.886967  3.174695  2.892969  8.935997
#> 272  3.254827  3.525641  3.148745  9.667853
#> 274  3.648556  3.878348  3.423913 10.349123
#> 276  4.003256  4.212769  3.519278 10.899524
#> 278  4.378399  4.595429  3.696335 11.611412
#> 280  4.746287  4.990905  4.096266 12.163997
#> 282  5.048703  5.305322  4.432054 12.787270
#> 284  5.368038  5.619465  4.825009 13.167885
#> 286  5.614410  5.916541  5.182212 13.381611
#> 288  5.851616  6.075996  5.487332 13.558316
#> 290  6.081863  6.261091  5.890714 13.682998
#> 292  6.275896  6.633030  6.402089 13.813230
#> 294  6.432444  7.011273  6.717044 14.065091
#> 296  6.568142  7.322688  7.167963 14.312001
#> 298  6.658399  7.639332  7.468584 14.429458
#> 300  6.735422  8.031794  7.777542 14.566432
#> 302  6.741072  8.287124  8.000036 14.609221
#> 304  6.744807  8.523735  8.190770 14.544052
#> 306  6.812991  8.869245  8.443191 14.503374
#> 308  6.888969  9.190256  8.707523 14.728691
#> 310  6.986671  9.552873  8.962353 14.804566
#> 312  7.105372  9.889659  9.214106 15.035337
#> 314  7.233311 10.152413  9.381807 15.225716
#> 316  7.385213 10.337440  9.518248 15.502102
#> 318  7.549992 10.434092  9.511002 15.561252