Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

correctWinPath

Correct mixed slash and backslash in file path


Description

This function corrects paths character strings for mixed slash and backslash in file path. In Windows the function tempdir() will use double backslashes as separator while file.path() uses regular slashes. So when combining these two one might encounter a mix of slashes and double backslashes which may cause trouble, unless this is streightened out to a single separator used. When pointig to given files inside html-files, paths need to have a prefix, this can be added using the argument asHtml.

Usage

correctWinPath(
  x,
  asHtml = FALSE,
  anyPlatf = FALSE,
  silent = TRUE,
  callFrom = NULL
)

Arguments

x

(character) input path to test and correct

asHtml

(logical) option for use in html : add prefix "file:/"

anyPlatf

(logical) if TRUE, checking will only be performed in Windows environement

silent

(logical) suppress messages

callFrom

(character) allows easier tracking of message(s) produced

Value

character vector with corrected path

See Also

Examples

path1 <- 'D:\\temp\\Rtmp6X8/working_dir\\RtmpKC/example.txt'
(path1b <- correctWinPath(path1, anyPlatf=TRUE)) 
(path1h <- correctWinPath(path1, anyPlatf=TRUE, asHtml=TRUE))

wrMisc

Analyze Experimental High-Throughput (Omics) Data

v1.5.4
GPL-3
Authors
Wolfgang Raffelsberger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.