export_results {Rtrack} | R Documentation |
Export experiment results to a dataframe or file.
Description
Binds experiment data together with analysis results and optionally writes this to file.
Usage
export_results(experiment, strategies = NULL, tracks = "all", file = NULL)
Arguments
experiment |
An |
strategies |
An optional |
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. |
file |
The file to which the results will be written. If |
Details
If only the results matching a thresholded subset of strategies should be
exported, then this can be achieved by performing strategy calling and
thresholding separately and passing the strategies$tracks
component of
the resulting rtrack_strategies
object to this function as the
parameter tracks
. This will restrict the output of
export_results
to only the tracks where an above-threshold strategy
has been determined.
If the parameter file
is supplied, the file extension will be used to
determine which format to save the file in. The formats ".csv", ".csv2" (see
write.table
for details of the formats), ".tsv" (
tab-delimited text; can also be written as ".txt" or ".tab") and ".xlsx" are
supported. If the file extension is not in this list, the data will be
written as tab-delimited text with a warning. Note that the Excel ".xlsx"
format is supported, but the older ".xls" is not.
Value
A data.frame
containing the experimental groups and factors
(as supplied in the original experiment description) together with the
summary metrics. This is returned invisibly if file
is specified.
See Also
call_strategy
, threshold_strategies
.
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"))
# The code below returns a data.frame.
# Use the parameter 'file' to write to a file instead.
export_results(experiment)