This function is capable of generating an application (.nax) file, which
contains compressed data files for the application. All files inside this
.nax file are organized in a fixed way, such that they are importable into a
ProxiMate device. For that, all models to be imported should be in a list,
and each individual model should be generated using the calibrate
function, preferably with the input data saved in it. This can easily be done
by calling the method with return_inputs = TRUE. Note that at least
one model in object must contain input data, otherwise an error will
occur.
Furthermore, note that the data argument in calibrate for
all models in one single application must be from one single data set.
In particular, one single data.frame must suffice to describe the inputs
of all models in object. The data that is actually used to train these
models can still be different, e.g. by specifying the rows that you want to
exclude from a certain model (see skip argument of calibrate).
An error will be thrown if this is not the case.
The directory path is created automatically (if it does not exist).
Inside, the application file is generated, which contains the following
compressed files: a file for the metadata (.nad), project (.prj) and
calibration (.cal) files for all the provided models in object,
possibly report (.rtf) files (as indicated by the report argument),
a tab-separated value (.tsv) file of the spectral data, and an empty
tab-separated value (.tsv) file.
The metadata file (.nad) is required for a successful import of the
application into a ProxiMate device. This requires metadata in every model,
which should be added using add_model_metadata prior
to the call of this function. Otherwise, default values for the model metadata
will be used with a warning. Furthermore, application specific metadata is
required, which can be either specified by providing the argument metadata,
or included in the list of models object (see add_application_metadata),
where the former option will take precedence.
If neither option is available, default values of add_application_metadata
are used with a warning.
Furthermore, this function provides a way of adding separately
generated project and calibration files through the parameter
external_properties. Note that these files have to be either in the
directory of the provided path or in a sub-directory "Calibrations"
thereof. External properties must be provided as a list containing model metadata
(using the add_model_metadata method) in order to be added properly
to the application file.
These external files must also be named according to the naming convention of
the rest of the models used. In particular, the function searches the
provided path and the sub-directory "Calibrations" for files named with
the following format: app_name.property_name.cal, app_name.property_name.prj
and (if report is TRUE) app_name.property_name.rtf, where
the app_name is taken from the application metadata, and the property_name
from model metadata passed to external_properties. If the files cannot be
found, a warning will be displayed.
An example for adding an external property is given in the example section below.
Note that if an application file for the given application already exists,
the files inside the compressed application file are updated, but already
present files are not deleted.