Reads pressure data from a CSV file in either wide (one column per sensor) or long (tidy) format.
Usage
pr_read_csv(
path,
format = c("wide", "long"),
layout = NULL,
time_col = NULL,
sampling_hz = 100,
verbose = TRUE
)Arguments
- path
Character. Path to CSV file.
- format
Character.
"wide"(default, columns are sensors) or"long"(a tidy format withframe,sensor_id,pressure).- layout
A pr_layout object. Required for wide format when the sensor count cannot be inferred.
- time_col
Character. Name of the time column. If
NULL, timestamps are generated fromsampling_hz.- sampling_hz
Numeric. Sampling rate. Default
100.- verbose
Logical. Default
TRUE.
Value
A pr_trial object.
Examples
tmp <- tempfile(fileext = ".csv")
m <- matrix(runif(10 * 99, 0, 100), nrow = 10, ncol = 99)
utils::write.csv(m, tmp, row.names = FALSE)
trial <- pr_read_csv(tmp, format = "wide", layout = pr_layout_insole(),
verbose = FALSE)
trial$n_frames
#> [1] 10