View source: R/loadAdatsAsList.R
| loadAdatsAsList | R Documentation |
Load a series of ADATs and return a list of soma_adat
objects, one for each ADAT file.
collapseAdats() concatenates a list of ADATs from loadAdatsAsList(),
while maintaining the relevant attribute entries (mainly the HEADER
element). This makes writing out the final object possible without the
loss of HEADER information.
loadAdatsAsList(files, collapse = FALSE, verbose = interactive(), ...)
collapseAdats(x)
files |
A character string of files to load. |
collapse |
Logical. Should the resulting list of ADATs be collapsed into a single ADAT object? |
verbose |
Logical. Should the function call be run in verbose mode. |
... |
Additional arguments passed to |
x |
A list of |
The default behavior is to "vertically bind"
(rbind()) on the intersect of the column variables, with
unique columns silently dropped.
If "vertically binding" on the column union is
desired, use dplyr::bind_rows(), however this results in NAs in
non-intersecting columns. For many files with little variable
intersection, a sparse RFU-matrix will result
(and will likely break ADAT attributes):
adats <- loadAdatsAsList(files) union_adat <- dplyr::bind_rows(adats, .id = "SourceFile")
A list of ADATs named by files, each a soma_adat object
corresponding to an individual file in files. For collapseAdats(),
a single, collapsed soma_adat object.
Stu Field
read_adat()
Other IO:
parseHeader(),
read_adat(),
soma_adat,
write_adat()
# only 1 file in directory
dir(system.file("extdata", package = "SomaDataIO"))
files <- system.file("extdata", package = "SomaDataIO") |>
dir(pattern = "[.]adat$", full.names = TRUE) |> rev()
adats <- loadAdatsAsList(files)
class(adats)
# collapse into 1 ADAT
collapsed <- collapseAdats(adats)
class(collapsed)
# Alternatively use `collapse = TRUE`
loadAdatsAsList(files, collapse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.