BIDSTabularSessions {bidsr} | R Documentation |
'BIDS' sessions table class
Description
A tabular containing a list of sessions and their metadata.
The class is a child class of BIDSTabular
, hence see
the methods there.
The original specification is at
https://bids-specification.readthedocs.io/en/stable/modality-agnostic-files.html#sessions-file.
Usage
BIDSTabularSessions(content, meta = NULL)
Arguments
content , meta |
see |
Value
A BIDSTabularSessions
instance inheriting
BIDSTabular
.
Author(s)
Zhengjia Wang
Examples
# basic
tabular <- BIDSTabularSessions(data.frame(
session_id = c("ses-predrug", "ses-postdrug", "ses-followup"),
acq_time = c(
"2009-06-15T13:45:30",
"2009-06-16T13:45:30",
"2009-06-17T13:45:30"
),
systolic_blood_pressure = c(120, 100, 110)
))
tabular
# convert existing tabular
tabular <- BIDSTabular(
data.frame(
acq_time = "2009-06-15T13:45:30",
session_id = "ses-predrug",
systolic_blood_pressure = 120
)
)
tabular <- as_bids_tabular(tabular, cls = BIDSTabularSessions)
tabular
# save to tsv
tsv <- file.path(tempdir(), "sessions.tsv")
paths <- save_bids_tabular(tabular, tsv)
print(paths)
# use base R to read
read.table(tsv, header = TRUE, na.strings = "n/a")
# get sidecar
cat(readLines(paths$sidecar_path), sep = "\n")
# clean up
unlink(tsv)
unlink(paths$sidecar_path)
[Package bidsr version 0.1.0 Index]