str_normalize_file | R Documentation |
Applies a set of regular-expression-based text normalization rules to one or more files. By default, changes are shown on the console only, without actually
modifying any files. Set run_dry = FALSE
to apply the changes.
str_normalize_file(
path,
rules = yay::regex_text_normalization,
run_dry = TRUE,
process_line_by_line = FALSE,
n_context_chrs = 20L,
verbose = TRUE
)
path |
Paths to the text files. A character vector. |
rules |
A data frame of regular expression |
run_dry |
Whether or not to show replacements on the console only, without actually modifying any files. Implies |
process_line_by_line |
Whether each line in a file should be treated as a separate string or the whole file as one single string. While the latter is
more performant, you probably want the former if you're using |
n_context_chrs |
The (maximum) number of characters displayed around the actual |
verbose |
Whether or not to display replacements on the console. |
path
invisibly.
Regular expression rules: regex_text_normalization
regex_file_normalization
Other string functions:
str_normalize()
,
str_replace_file()
,
str_replace_verbose()
# Use POSIX-related file normalization rule(s) included in this package
temp_file <- tempfile()
download.file(url = paste0("https://raw.githubusercontent.com/RcppCore/Rcpp/72f0652b93f196d",
"64faab6b108cd02a197510a7b/inst/include/Rcpp/utils/tinyformat.h"),
destfile = temp_file,
quiet = TRUE,
mode = "wb")
yay::regex_file_normalization |>
dplyr::filter(category == "posix") |>
yay::str_normalize_file(path = temp_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.