list_csv: Import multiple common files from a directory into a list.

Description Usage Arguments Value See Also Examples

View source: R/list_csv.R

Description

These functions wrap common use-cases of list_any().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
list_csv(
  path = ".",
  regexp = "[.]csv$",
  ignore.case = TRUE,
  invert = FALSE,
  ...
)

list_tsv(
  path = ".",
  regexp = "[.]tsv$",
  ignore.case = TRUE,
  invert = FALSE,
  ...
)

list_rds(path = ".", regexp = "[.]rds$", ignore.case = TRUE, invert = FALSE)

list_rdata(
  path = ".",
  regexp = "[.]rdata$|[.]rda$",
  ignore.case = TRUE,
  invert = FALSE
)

Arguments

path

A character vector of one path. Defaults to the working directory.

regexp

A regular expression (e.g. [.]csv$) passed on to grep() to filter paths.

ignore.case

if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

invert

If TRUE return files which do not match

...

Arguments passed to readr::read_csv() or readr::read_tsv().

Value

A list.

See Also

Other functions to import files into a list: list_any()

Other functions to import files of common formats: load_csv()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
(rds <- tor_example("rds"))
dir(rds)

list_rds(rds)

(tsv <- tor_example("tsv"))
dir(tsv)

list_tsv(tsv)

(mixed <- tor_example("mixed"))
dir(mixed)

list_rdata(mixed)

list_csv(mixed)

list_rdata(mixed, regexp = "[.]RData", ignore.case = FALSE)

tor documentation built on March 26, 2020, 7:29 p.m.