Export ESR spectrum objects as .SPC/.PAR or .TXT files.
write_Spectrum(x, file, type = c("SPC", "TXT")[1], sep = "\t", gvalue = FALSE, ...)
x |
|
---|---|
file | character (required): A character string naming a file for writing. |
type | character (with default): Indicates the file type the data is exported as:
|
sep | character (with default):
The field separator string. Values within each row of x are separated by
this string. Only used if |
gvalue | logical (with default):
Export the spectrum with g-values instead of magnetic field values. Requires
all necessary information in the |
... | currently not used. |
Write files to the disk, no further output provided.
SPC file format
If type = 'SPC'
this function will write a binary file as is produced
by a Bruker ESP300-E spectrometer. These files use a big-endian byte order
with 4 bytes per element in the byte stream. This format only stores integer
values, so exporting a floating-point number spectrum might introduce
more or less severe rounding errors. To counteract this, the function
multiplies all intensity values by 1000 before exporting. This preserves
relative differences in spectra, but absolute intensity values may no longer
be interpreted at face value.
The measurement parameters are written to a separate <file>.PAR
file with
two whitespaces as field seperator and macintosh style carriage return
line breaks.
# NOT RUN { ## Load example data set file <- system.file("inst/extdata/quartz.DTA", package = "ESR") ## Import the file x <- read_Spectrum(file, verbose = FALSE) ## Export as ESP300-E .SPC/.PAR file set write_Spectrum(x = x, file = "~/exported.SPC", type = "SPC") ## Export as plain text write_Spectrum(x = x, file = "~/exported.txt", type = "TXT", gvalue = TRUE, sep = ",") # }