Import multiple files of any format from a directory into a list.
list_any( path = ".", .f, regexp = NULL, ignore.case = FALSE, invert = FALSE, ... )
path | A character vector of one path. Defaults to the working directory. |
---|---|
.f | A function able to read the desired file format. |
regexp | A regular expression (e.g. |
ignore.case | if |
invert | If |
... | Additional arguments passed to |
A list.
Other functions to import files into a list:
list_csv()
Other functions to import files of any format:
load_any()
#> [1] "csv" "mixed" "rdata" "rds" "tsv"#> [1] "/home/runner/work/_temp/Library/tor/extdata/csv"#> [1] "csv1.csv" "csv2.csv"list_any(path, read.csv)#> $csv1 #> # A tibble: 2 × 1 #> x #> <int> #> 1 1 #> 2 2 #> #> $csv2 #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #>#> $csv1 #> # A tibble: 2 × 1 #> x #> <int> #> 1 1 #> 2 2 #> #> $csv2 #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #>#> [1] "/home/runner/work/_temp/Library/tor/extdata/mixed"#> [1] "csv.csv" "lower_rdata.rdata" "rda.rda" #> [4] "upper_rdata.RData"#> $lower_rdata #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #> #> $upper_rdata #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #>#> $lower_rdata #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #> #> $rda #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #> #> $upper_rdata #> # A tibble: 2 × 1 #> y #> <chr> #> 1 a #> 2 b #>