Learn R Programming

mclm (version 0.2.7)

read_fnames: Read a collection of filenames from a text file

Description

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, ...)

Value

An object of class fnames.

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).

See Also

write_fnames()

Other reading functions: read_assoc(), read_conc(), read_freqlist(), read_tokens(), read_txt(), read_types()

Examples

Run this code
.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)

Run the code above in your browser using DataLab