feemlist {albatross} | R Documentation |
Create lists of FEEM objects
Description
Convert vectors of file names or objects from other packages (such as
eemR or EEM) into flat named lists of
feem
objects.
Usage
feemlist(x, ...)
## S3 method for class 'character'
feemlist(
x, format, pattern = NULL, recursive = TRUE, ignore.case = FALSE,
simplify.names = TRUE, progress = TRUE, ...
)
## S3 method for class 'eemlist'
feemlist(x, ...)
## S3 method for class 'EEM'
feemlist(x, ...)
Arguments
x |
A character vector containing names of files and directories to
import using Alternatively, an |
format |
Corresponds to the Alternatively, can be a function that takes a path to a file and
anything passed in |
pattern , recursive , ignore.case |
These options are passed to |
simplify.names |
If |
progress |
If true, show a text progress bar using
|
... |
When importing files, remaining options are passed to
|
Details
Names of x
are preserved; if x
is not named, names are
assigned from the values of x
itself, and so are empty names
in partially-named x
. Every directory in x
is replaced
with its contents (as returned by list.files
),
their names obtained by concatenating the name of the directory
element with their paths inside the directory (with
.Platform$file.sep
as a separator). For example,
when importing x = c('foo' = 'bar')
with directory ‘bar’
containing ‘baz.txt’, resulting name would be ‘foo/baz.txt’.
When importing many files from the same directory, the
simplify.names
option is useful to avoid duplication in resulting
names. For example,
feemlist('.', simplify.names = FALSE)
results in a list with
all names starting with ./
, while
feemlist('foo/bar/baz', simplify.names = TRUE)
(default) would
shave off all three common path components and the separators.
Mixing files and directories in x
will most likely not preserve
the order of the elements.
Note: Please don't rely on the name generation behaving exactly as specified as it may be changed in the future versions.
When importing custom file formats, the format
function should
typically take the following form:
function(filename, ...) { # read data from filename # take additional arguments passed from feemlist(...) if needed return(feem(data)) }
Value
A flat named list of feem
objects.
See Also
feem
; the packages eemR and EEM.
Examples
feemlist(
system.file('extdata/pano2.txt', package = 'albatross'),
'table', transpose = TRUE, na = 0
)
if (requireNamespace('eemR')) feemlist(eemR::eem_read(
system.file('extdata/ho_aq.csv', package = 'albatross'),
import_function='aqualog'
))
if (requireNamespace('EEM')) feemlist(EEM::readEEM(
system.file('extdata/ho_aq.dat', package = 'albatross')
))
feemlist(
system.file('extdata/custom.rds', package = 'albatross'),
readRDS
)