Skip to contents

This function reads an object of class fnames from a text file, which is assumed to contain one filename on each line.

Usage

read_fnames(file, sep = NA, file_encoding = "UTF-8", trim_fnames = FALSE, ...)

Arguments

file

Path to input file.

sep

Character vector of length 1 or NA. If it is a character, it indicates a separator between input files, in addition to the new line.

file_encoding

Encoding used in the input file.

trim_fnames

Boolean. Should leading and trailing whitespace be stripped from the filenames?

...

Additional arguments (not implemented).

Value

An object of class fnames.

See also

Examples

.old_wd <- setwd(tempdir())
cwd_fnames <- as_fnames(c("file1.txt", "file2.txt"))
write_fnames(cwd_fnames, "file_with_filenames.txt")
cwd_fnames_2 <- read_fnames("file_with_filenames.txt")
setwd(.old_wd)