| read_text | R Documentation |
Functions for reading spectral data from external file types.
Currently supported reading formats are .csv and other text files, .asp,
.spa, .spc, .xyz, and .jdx.
Additionally, .0 (OPUS) and .dat (ENVI) files are supported via
read_opus() and read_envi(), respectively.
read_zip() takes any of the files listed above.
Note that proprietary file formats like .0, .asp, and .spa are poorly
supported but will likely still work in most cases.
read_text(
file,
colnames = NULL,
method = "fread",
comma_decimal = TRUE,
metadata = list(file_name = basename(file), user_name = NULL, contact_info = NULL,
organization = NULL, citation = NULL, spectrum_type = NULL, spectrum_identity = NULL,
material_form = NULL, material_phase = NULL, material_producer = NULL,
material_purity = NULL, material_quality = NULL, material_color = NULL,
material_other = NULL, cas_number = NULL, instrument_used = NULL,
instrument_accessories = NULL, instrument_mode = NULL, spectral_resolution = NULL,
laser_light_used = NULL, number_of_accumulations = NULL,
total_acquisition_time_s = NULL, data_processing_procedure = NULL,
level_of_confidence_in_identification = NULL, other_info = NULL, license =
"CC BY-NC"),
...
)
read_asp(
file,
metadata = list(file_name = basename(file), user_name = NULL, contact_info = NULL,
organization = NULL, citation = NULL, spectrum_type = NULL, spectrum_identity = NULL,
material_form = NULL, material_phase = NULL, material_producer = NULL,
material_purity = NULL, material_quality = NULL, material_color = NULL,
material_other = NULL, cas_number = NULL, instrument_used = NULL,
instrument_accessories = NULL, instrument_mode = NULL, spectral_resolution = NULL,
laser_light_used = NULL, number_of_accumulations = NULL,
total_acquisition_time_s = NULL, data_processing_procedure = NULL,
level_of_confidence_in_identification = NULL, other_info = NULL, license =
"CC BY-NC"),
...
)
read_spa(
file,
metadata = list(file_name = basename(file), user_name = NULL, contact_info = NULL,
organization = NULL, citation = NULL, spectrum_type = NULL, spectrum_identity = NULL,
material_form = NULL, material_phase = NULL, material_producer = NULL,
material_purity = NULL, material_quality = NULL, material_color = NULL,
material_other = NULL, cas_number = NULL, instrument_used = NULL,
instrument_accessories = NULL, instrument_mode = NULL, spectral_resolution = NULL,
laser_light_used = NULL, number_of_accumulations = NULL,
total_acquisition_time_s = NULL, data_processing_procedure = NULL,
level_of_confidence_in_identification = NULL, other_info = NULL, license =
"CC BY-NC"),
...
)
read_spc(
file,
metadata = list(file_name = basename(file), user_name = NULL, contact_info = NULL,
organization = NULL, citation = NULL, spectrum_type = NULL, spectrum_identity = NULL,
material_form = NULL, material_phase = NULL, material_producer = NULL,
material_purity = NULL, material_quality = NULL, material_color = NULL,
material_other = NULL, cas_number = NULL, instrument_used = NULL,
instrument_accessories = NULL, instrument_mode = NULL, spectral_resolution = NULL,
laser_light_used = NULL, number_of_accumulations = NULL,
total_acquisition_time_s = NULL, data_processing_procedure = NULL,
level_of_confidence_in_identification = NULL, other_info = NULL, license =
"CC BY-NC"),
...
)
read_jdx(
file,
metadata = list(file_name = basename(file), user_name = NULL, contact_info = NULL,
organization = NULL, citation = NULL, spectrum_type = NULL, spectrum_identity = NULL,
material_form = NULL, material_phase = NULL, material_producer = NULL,
material_purity = NULL, material_quality = NULL, material_color = NULL,
material_other = NULL, cas_number = NULL, instrument_used = NULL,
instrument_accessories = NULL, instrument_mode = NULL, spectral_resolution = NULL,
laser_light_used = NULL, number_of_accumulations = NULL,
total_acquisition_time_s = NULL, data_processing_procedure = NULL,
level_of_confidence_in_identification = NULL, other_info = NULL, license =
"CC BY-NC"),
...
)
read_extdata(file = NULL)
read_h5(
file,
collapse = FALSE,
spectral_smooth = FALSE,
sigma = c(1, 1, 1),
read_visual = TRUE,
representation = c("OpenSpecy", "Specs"),
background_filter = NULL,
...
)
file |
file to be read from or written to. |
colnames |
character vector of |
method |
submethod to be used for reading text files; defaults to
|
comma_decimal |
logical(1) whether commas may represent decimals. |
metadata |
a named list of the metadata; see |
collapse |
whether or not to use |
spectral_smooth |
logical; whether H5 cubes should be smoothed before matrix conversion. |
sigma |
numeric vector passed to |
read_visual |
logical; whether H5 mosaic images should be attached as
visual-image attributes when present. H5 region stage coordinates are kept
in nanometres and all mosaic tiles intersecting each region are registered
for overlays and feature color extraction.
|
representation |
for H5 maps, return an ordinary dense
|
background_filter |
optional H5 map policy returned by
|
... |
further arguments passed to the submethods. |
read_spc() and read_jdx() are wrappers around the
functions provided by the hyperSpec.
Other functions have been adapted various online sources.
Metadata is harvested if possible.
There are many unique iterations of spectral file formats so there may be
bugs in the file conversion. Please contact us if you identify any.
Text and single-spectrum readers return their established objects.
read_h5() returns an OpenSpecy object by default or a compact
Specs object when requested.
Zacharias Steinmetz, Win Cowger
read_spec() for reading .json, .rds, or .csv (OpenSpecy)
files;
read_opus() for reading .0 (OPUS) files;
read_envi() for reading .dat (ENVI) files;
read_zip() and read_any() for wrapper functions;
read.jdx(); read.spc()
read_extdata("raman_hdpe.csv") |> read_text()
read_extdata("raman_atacamit.spc") |> read_spc()
read_extdata("ftir_ldpe_soil.asp") |> read_asp()
read_extdata("testdata_zipped.zip") |> read_zip()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.