filter_files | R Documentation |
Filters a character vector of file paths using a user-defined pattern and additional content-based criteria to ensure only likely text files are retained.
This function applies multiple filters:
A regex-based path filter (if provided).
Exclusion of files located within .git
folders.
Exclusion of files with known binary or non-text extensions.
A fallback scan for embedded null bytes to detect binary content in ambiguous files.
The function returns a filtered character vector of file paths likely to be valid text files.
filter_files(files, filter, negate, n = 1000L)
files |
A character vector of files to search (only for |
filter |
Optional. A regular expression pattern used to filter file paths
before reading. If |
negate |
Logical. If |
n |
The number of bytes to read for binary detection in files with unknown extensions. Defaults to 1000. |
A character vector of file paths identified as potential text files. If no matching files are found, an informative error is thrown.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.