Description Usage Arguments Details Value Examples
Make a string used as part of a file path legal on a file system by removing illegal characters. The defaults should give a good portable result for most modern file systems.
1 2 3 4 5 6 7 |
inf |
A character vector to be cleaned into a file name component. |
suffix |
A suffix to be attached if any, e.g. .PDF or .document. |
blacklist |
A regular expression character class used as a blacklist, i.e. the negated white list of characters. It's a very safe set, please use what you feel is safe in your circumstances. The default safe characters are:
|
File systems tolerate certain characters in a file name. Some characters are not legal. This function will replace all characters that are not white listed with space. Multiple consecutive spaces will be replaced with a single one and the leading and trailing spaces will be stripped.
The cleaning is not comprehensive. It deals with characters only. For example, P, R and N are perfectly legal in Windows but a file named PRN might not be very useful. However, for example, it will strip out | (a pipe) as an illegal character. Linux and others allow a broader character sets in file names than Windows, but the point of this function is to create a safe portable name.
Cleaned file name component.
1 | clean_file_name(c("fred123", "some file", "bad & good##", "w##H$A%t^"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.