Writes physiological signal data to a CSV file.
Usage
writeCSV(
x,
path,
format = c("wide", "long"),
include_time = TRUE,
assay_name = NULL,
sep = ",",
...
)Arguments
- x
A PhysioExperiment object.
- path
Output file path.
- format
Output format: "wide" (time x channels) or "long".
- include_time
Logical. If TRUE, includes a time column.
- assay_name
Assay to export. If NULL, uses default assay.
- sep
Column separator. Default is ",".
- ...
Additional arguments passed to write.csv/write.table.
References
Wickham H (2014). "Tidy Data." Journal of Statistical Software, 59(10), 1-23. doi:10.18637/jss.v059.i10
Examples
# Create example data
pe <- PhysioExperiment(
assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)),
colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")),
samplingRate = 100
)
# Write to temporary CSV file
tmp <- tempfile(fileext = ".csv")
writeCSV(pe, tmp)
# Write in long format
writeCSV(pe, tmp, format = "long")
# Clean up
unlink(tmp)