Generic function to parse spectra files that don't have a specific parser
Source:R/parse_generic.R
lr_parse_generic.Rd
Generic function to parse spectra files that don't have a specific parser
Value
A named list of two elements:
data
: a dataframe with columns "wl", "dark", "white", "scope" and "processed", in this order.metadata
: a character vector with metadata including:user
: Name of the spectrometer operatordatetime
: Timestamp of the recording in format '%Y-%m-%d %H:%M:%S' and UTC timezone. If timezone is missing in source file, UTC time will be assumed (for reproducibility purposes across computers with different localtimes).spec_model
: Model of the spectrometerspec_ID
: Unique ID of the spectrometerwhite_inttime
: Integration time of the white reference (in ms)dark_inttime
: Integration time of the dark reference (in ms)sample_inttime
: Integration time of the sample (in ms)white_avgs
: Number of averaged measurements for the white referencedark_avgs
: Number of averaged measurements for the dark referencesample_avgs
: Number of averaged measurements for the samplewhite_boxcar
: Boxcar width for the white referencedark_boxcar
: Boxcar width for the dark referencesample_boxcar
: Boxcar width for the sample reference
Examples
res_csv <- lr_parse_generic(
system.file("testdata", "spec.csv", package = "lightr"),
sep = ","
)
head(res_csv$data)
#> wl dark white scope processed
#> 1 299.99 NA NA NA 10.013
#> 2 300.20 NA NA NA 7.331
#> 3 300.42 NA NA NA 12.082
#> 4 300.63 NA NA NA 7.949
#> 5 300.85 NA NA NA 5.962
#> 6 301.06 NA NA NA 7.525
# No metadata is extracted with this parser
res_csv$metadata
#> [1] NA NA NA NA NA NA NA NA NA NA NA NA NA
res_craic <- lr_parse_generic(
system.file("testdata", "CRAIC_export.txt", package = "lightr")
)
head(res_craic$data)
#> wl dark white scope processed
#> 1 280.11 NA NA NA 13.3999
#> 2 280.28 NA NA NA 13.2646
#> 3 280.45 NA NA NA 13.4097
#> 4 280.62 NA NA NA 13.9000
#> 5 280.79 NA NA NA 13.5736
#> 6 280.96 NA NA NA 13.9723
# No metadata is extracted with this parser
res_craic$metadata
#> [1] NA NA NA NA NA NA NA NA NA NA NA NA NA