make.filenames: [!+] Convert string into Windows compatible filename

Description Usage Arguments Value See Also Examples

View source: R/make.filenames.R

Description

Function replaces special symbols (\" / : * ? < > |) in a string s with replacement (by default it is underscore _). After replacement the string can be used as a file name in Windows.

Usage

1
make.filenames(s, replacement = "_", allow.space = TRUE)

Arguments

s

A string.

replacement

A symbol to replce unallowed symbols with. replacement must be an allowed symbol.

allow.space

Logical. If FALSE, space will be repalaced with replacement. Default is TRUE.

Value

A string without special symbols.

See Also

Other spMisc utilities: bru(), clc(), clear(), fCap(), isFALSE(), list_AddRm(), open_wd(), printDuration(), regexp2df(), st01()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 s <- '\\ / : * ? " < > |'
 make.filenames(s)
 #> "_ _ _ _ _ _ _ _ _"

 make.filenames(s, allow.space = FALSE)
 #> "_________________"


 s2 <- "/Hello?"
 make.filenames(s2)
 #> "_Hello_"

 make.filenames(s2, replacement = "-")
 #> "-Hello-"

GegznaV/spMisc documentation built on April 26, 2020, 5:59 p.m.