Import multiple files of any format from a directory into an environment.
load_any( path = ".", .f, regexp = NULL, ignore.case = FALSE, invert = FALSE, envir = .GlobalEnv, ... )
A character vector of one path. Defaults to the working directory.
A function able to read the desired file format.
A regular expression (e.g. [.]csv$) passed on to grep() to filter paths.
[.]csv$
grep()
if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.
FALSE
TRUE
If TRUE return files which do not match
an environment or NULL.
environment
NULL
Additional arguments passed to .f.
.f
invisible(path).
invisible(path)
Other functions to import files into an environment: load_csv()
load_csv()
Other functions to import files of any format: list_any()
list_any()
# NOT RUN { e <- new.env() load_any(tor_example("rdata"), .f = ~ get(load(.x)), envir = e) ls(e) # The data is now available in the environment `e` e$rdata1 e$rdata2 # }
Run the code above in your browser using DataLab