View source: R/proximate_write_data.R
| proximate_write_data | R Documentation |
This function writes tab-separated value files in a readable NIRWise PLUS software format. These files contain visible and Near-Infrared absorbance spectra along with response variables and metainformation (e.g. sample ID, date, comments, etc).
proximate_write_data(x,
file,
id,
spc,
spc_round = 8,
barcode = "",
properties = NULL,
note = "",
recipe = "",
created,
snr)
x |
a data.frame of spectral data and metadata, for which the tab separated value file should be generated. See details. |
file |
a character for the path (and name) in which the tsv will be saved. |
id |
a vector of characters of length equal to the number of observations
in |
spc |
either a character or a vector of integers. Specifies where the
spectra can be found inside |
spc_round |
an integer. To how many decimal places should the spectra be rounded? Defaults to 8 decimal places. |
barcode |
a vector of characters of length equal to the number of
observations in |
properties |
a vector of characters of arbitrary length. Which properties
in |
note |
a vector of characters of length equal to the number of observations
in |
recipe |
a vector of characters of length equal to the number of observations
in |
created |
a vector of characters of length equal to the number of observations
in |
snr |
a vector of characters, corresponding to the serial number of the
device on which the measurement was taken. If not provided and not found in
|
This function creates a tab separated value file, which is readable by both
NIRWise PLUS software and the proximate_read_data function.
The main usage is to transform an already given data file into a format which
is readable by NIRWise PLUS. Therefore, if some data of the given object
x is already of the correct form, one can pass the corresponding values
simply by passing the specific row of x to this function; for example,
by passing note = x$Note.
Invisibly returns NULL. Called for its side effect of
writing a tab-separated value file to file.
Leonardo Ramirez-Lopez
data("proximateCannabis")
filename <- file.path(tempdir(), "proximateCannabis.tsv")
proximate_write_data(
x = proximateCannabis,
file = filename,
id = proximateCannabis$ID,
spc = "spc",
spc_round = 8,
barcode = proximateCannabis$Barcode,
properties = c("CBDA", "THCA", "CBD", "THC"),
note = proximateCannabis$Note,
recipe = proximateCannabis$Recipe,
created = proximateCannabis$Begin
)
# Since we do not change anything, the following produces the same tsv:
proximate_write_data(
x = proximateCannabis,
file = filename,
properties = c("CBDA", "THCA", "CBD", "THC")
)
# Delete the file
file.remove(filename)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.