Use this function to import a series of associated ESR spectra into R.

read_Spectrum(file, device = "auto", ...)

Arguments

file

character (required): file path or directory where the spectra files are stored.

device

character (with default): Manually specify the device the spectrum files were produced by. By default, the proper binary format is deduced from the file extension, which may however fail in case of ambiguous file endings. See details.

Allowed options are:

  • "auto" (the default)

  • "ESP300-E" (.SPC)

  • "ELEXSYS500" (.DTA)

  • "EMXplus" (.SPC)

...

further arguments (e.g., n to specify the number of datapoints; sw to specify the sweep width).

Value

Returns a terminal output. In addition an R6Class object is returned.

Details

This is a wrapper function for read.table and readBin. The function should be used to read in a series of associated ESR spectrum files. A list with all spectrum data is returned, which can be passed to plot_Spectrum for plotting the spectra.

Binary formats

This function is able to read in binary spectrum files produced by Bruker ESR devices. By default (device = 'auto'), the function assumes the proper mode of the vector (integer or numeric), endianness and number of bytes per element based on the file extension. Currently, the following devices are supported:

  • Bruker ESP300-E (.SPC files): what = 'int', endian = 'big', size = 4

  • Bruker ELEXSYS500 (.DTA files): what = 'numeric', endian = 'big', size = 8

  • Bruker EMXplus (old) (.SPC files): what = 'numeric', endian = 'little', size = 4

Note that the Bruker ESP300-E and EMXplus devices share a common file extension (.SPC) and that device = 'auto' (the default) will always assume that the SPC file is from a ESP300-E. If your SPC file is from a EMXplus, however, you should manually specify this using device = 'EMXplus'.

References

In progress

See also

Examples

# Import ASCII text file file1 <- system.file("extdata", "coral.txt", package = "ESR") spec1 <- read_Spectrum(file1)
#> #> Job done!
# Import .zip archive file2 <- system.file("extdata", "mollusc.zip", package = "ESR") spec2 <- read_Spectrum(file2)
#> .zip files are currently not supported. The file was skipped.
# Import Bruker ESP300-E raw binary spectrum file3 <- system.file("extdata", "mollusc.SPC", package = "ESR") spec3 <- read_Spectrum(file3)
#> #> Job done!
# Import Bruker ELEXSYS500 spectrum (ASCII) file4 <- system.file("extdata", "dpph.ASC", package = "ESR") spec4 <- read_Spectrum(file4)
#> #> Job done!
# Import Bruker ELEXSYS500 raw binary spectrum file5 <- system.file("extdata", "quartz.DTA", package = "ESR") spec5 <- read_Spectrum(file5)
#> #> Job done!
# Import Bruker EMXplus raw binary spectrum file6 <- system.file("extdata", "DL_alanine.spc", package = "ESR") spec6 <- read_Spectrum(file6, device = "EMXplus")
#> #> Job done!
# Import all example data sets at once by providing only the directory dir <- system.file("extdata", package = "ESR") specs <- read_Spectrum(dir)
#> .zip files are currently not supported. The file was skipped.
#> Invalid data format! Data was not saved.
#> #> Job done!