This function parses a string to a format easier to use in filenames by removing spaces and replacing with a symbol like "-" and converting all letters to lowercase and removing special symbols.

strToFileName(s, sep = "-")

Arguments

s

string parameter to convert to (string)

sep

optional parameter, symbol to separate words by, default is "-" (string)

Value

returns a parsed string formatted better for filenames

Examples

strToFileName(s = "This is an example FiLeNme with# (symbols >=4) to remove")
#> [1] "this-is-an-example-filenme-with-symbols-GE4-to-remove"