export_data {Rtrack} | R Documentation |
Export experiment data to a trackxf file.
Description
Creates a representation of the experiment data in the trackxf format and writes this to file.
Usage
export_data(experiment, file, tracks = "all")
Arguments
experiment |
An |
file |
The file to which the archive will be written. This should
ideally use the file extension |
tracks |
Which tracks should be exported. Default, "all" exports the entire experiment object. A subset of tracks can be specified using either numeric indices or a vector of track IDs following usual R standards. |
Details
The exported trackxf file contains all the raw data and experiment metadata. The trackxf archive contains exactly the same information as if reading from raw data. Calculated metrics are not exported, but can be recreated exactly.
A formal description of the trackxf JSON format can be found in the schema file at https://rupertoverall.net/trackxf/trackxf_schema_v0.json.
See Also
read_experiment
to import the archive back into an
rtrack_experiment
object.
Examples
require(Rtrack)
experiment.description <- system.file("extdata", "Minimal_experiment.xlsx",
package = "Rtrack")
experiment <- read_experiment(experiment.description, format = "excel",
project.dir = system.file("extdata", "", package = "Rtrack"))
tempfile <- file.path(tempdir(), "Minimal_experiment.trackxf") # Temporary file
export_data(experiment, file = tempfile)
imported.experiment <- read_experiment(tempfile, format = "trackxf")
# Experiments are identical except for export timestamp/notes
all.equal(experiment, imported.experiment)
identical(experiment$metrics, imported.experiment$metrics)