export_data: Export experiment data to a trackxf file.

View source: R/export_data.R

export_dataR 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 rtrack_experiment object from read_experiment.

file

The file to which the archive will be written. This should ideally use the file extension .trackxf although other extensions are also possible. If the filename is given without any extension (recommended), then the .trackxf extension will be added automatically.

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)


Rtrack documentation built on Aug. 10, 2023, 9:10 a.m.

Related to export_data in Rtrack...