Learn R Programming

ir (version 0.4.1)

ir_export_prepare: Prepares ir objects for export to csv

Description

Prepares ir objects for export to csv files. To export ir objects to csv, the spectra column has to be converted to an own data frame and be exported separately from the metadata. When preparing metadata for export, ir_export_prepare takes care of separating measurement units and measurement errors in columns of class units::units, errors::errors, and quantities::quantities (see the examples).

Usage

ir_export_prepare(
  x,
  what = "metadata",
  measurement_id = as.character(seq_len(nrow(x)))
)

Value

A data frame.

Arguments

x

An object of class ir.

what

A character value defining what to prepare for export. If "metadata", the metadata will be prepared for export and column spectra will be dropped. If "spectra", x is converted to an object of class ir_flat.

measurement_id

A character vector an element for each row in x that contains the names to use as column names for the spectra in the ir_flat object to create.

Examples

Run this code
x_spectra <- ir_export_prepare(ir_sample_data[1:5, ], what = "spectra")
x_metadata <- ir_export_prepare(ir_sample_data[1:5, ], what = "metadata")

Run the code above in your browser using DataLab