lr_parse_generic: Generic function to parse spectra files that don't have a...

View source: R/parse_generic.R

lr_parse_genericR Documentation

Generic function to parse spectra files that don't have a specific parser

Description

Generic function to parse spectra files that don't have a specific parser

Usage

lr_parse_generic(filename, decimal = ".", sep = NULL)

Arguments

filename

Path of the file to parse

decimal

Character to be used to identify decimal plates (defaults to .).

sep

Column delimiting characters to be considered in addition to the default (which are: tab, space, and ";")

Details

'processed' column computed by official software and provided as is.

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 operator

    • datetime: 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 spectrometer

    • spec_ID: Unique ID of the spectrometer

    • white_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 reference

    • dark_avgs: Number of averaged measurements for the dark reference

    • sample_avgs: Number of averaged measurements for the sample

    • white_boxcar: Boxcar width for the white reference

    • dark_boxcar: Boxcar width for the dark reference

    • sample_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)
# No metadata is extracted with this parser
res_csv$metadata

res_craic <- lr_parse_generic(
  system.file("testdata", "CRAIC_export.txt", package = "lightr")
)
head(res_craic$data)
# No metadata is extracted with this parser
res_craic$metadata


lightr documentation built on May 29, 2024, 1:27 a.m.