tor (to-R) helps you to import multiple files at once. For example:

  • Run list_rds() to import all .csv files from your working directory into a list.
  • Run load_csv() to import all .csv files from your working directory into your global environment.

Installation

Install tor from CRAN with:

Or install the development version from GitHub with:

Example

library(tor)

list_*(): Import multiple files from a directory into a list

All functions default to importing files from the working directory.

Often you will specify a path to read from.

You may read all files with a particular extension.

Or you may read specific files matching a pattern.

list_rdata(path_mixed, regexp = "[.]RData", ignore.case = FALSE)
#> $upper_rdata
#> # A tibble: 2 x 1
#>   y    
#>   <chr>
#> 1 a    
#> 2 b

list_any() is the most flexible function. You supply the function to read with.

It understands lambda functions and formulas (powered by rlang).

Pass additional arguments via ... or inside the lambda function.

It also provides the arguments regexp, ignore.case, and invert to pick specific files in a directory (powered by fs).

load_*(): Load multiple files from a directory into an environment

All functions default to importing files from the working directory and into the global environment.

You may import files from a specific path.

You may import files into a specific environment.

For more flexibility use load_any() with a function able to read one file of the format you want to import.