fnames | R Documentation |
Build an object of class fnames
.
get_fnames( path = ".", re_pattern = NULL, recursive = TRUE, perl = TRUE, invert = FALSE )
path |
The location of the files to be listed. |
re_pattern |
Optional regular expression. If present, then only the
filenames that match it are retrieved (unless |
recursive |
Boolean value. Should the subdirectories of |
perl |
Boolean value. Whether |
invert |
Boolean value. If |
An object of class fnames
, which is a special kind of character
vector storing the absolute paths of the corpus files.
It has additional attributes and methods such as:
base print()
, as_data_frame()
,
sort()
and summary()
(which returns the number of items and of unique items),
tibble::as_tibble()
,
an interactive explore()
method,
a function to get the number of items n_fnames()
,
subsetting methods such as keep_types()
, keep_pos()
, etc. including []
subsetting (see brackets), as well as the specific functions keep_fnames()
and drop_fnames()
.
Additional manipulation functions includes fnames_merge()
to combine
filenames collections and the short_names()
family of functions to shorten
the names.
Objects of class fnames
can be saved to file with write_fnames()
;
these files can be read with read_fnames()
.
It is possible to coerce a character vector into an fnames
object with as_fnames()
.
cwd_fnames <- get_fnames(recursive = FALSE) cwd_fnames <- as_fnames(c("file1", "file2", "file3")) cwd_fnames print(cwd_fnames) as_data_frame(cwd_fnames) as_tibble(cwd_fnames) sort(cwd_fnames) summary(cwd_fnames)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.