replace_sp_chars_filename {autoharp}R Documentation

Replace Special Characters in File Name


Replaces special characters in the name of an R or Rmd script.


replace_sp_chars_filename(dir_name, return_df = TRUE)



A character string, referring to the directory of Rmd files whose names should be replaced.


A logical value, indicating if the old and new names should be returned (in a tibble).


If a filename contains one of the following special characters (ignore the quotes here): "[ <>()|\:&;#?*']", the knit function will replace them with underscores. Hence the filenames in the autoharp input directory and the output directory will not match, even allowing for the change in file extension. This will cause problems when we try to run render_one again on the same input directory.

This function renames the files in the input directory by replacing all special characters there.

The NUS LMS (LumiNUS) introduces parenthesized names or numbers in order to make filenames unique, so this function is necessary for NUS instructors.


A tibble containing the old and new names.

[Package autoharp version 0.0.8 Index]