Displaying 2 results from an estimated 2 matches for "back2forwardslash".
2012 Jun 10
1
Convert "\" to "/"?
...eck" ("parse error: unexpected input"). I have so
far not found a way to eliminate the warning without wrapping examples
in "\dontrun" or making the examples hard to understand; neither of
these alternatives are acceptable.
The following is my current solution:
back2ForwardSlash <- function(nmax=1, what=character(), sep='\n', ...){
x2 <- scan(what=what, nmax=nmax, sep=sep, ...)
x. <- gsub('\\', '/', x2, fixed = TRUE)
}
(x <- back2ForwardSlash())
c:\Users\
all.equal(x, 'c:/Users/')
# TRUE
x2. <- back2ForwardSlash(2)
c:\u\...
2012 Feb 29
1
Replace back slashes with forward slashes?
...something
better, I plan to add this to the "sos" package and issue a new release
very soon. (The new release is needed, because the RSiteSearch
capability has been modified in a way that breaks the current "findFn"
core of "sos".)
Thanks,
Spencer
back2forwardslash <- function (nmax = 1, pattern = "\\", replacement =
"/") {
x <- scan(what = character(), quote = pattern, nmax = nmax)
x. <- gsub(pattern, replacement, x, fixed = TRUE)
paste(x., collapse = " ")
}
(x <- back2forwardslash())
c:\Users\
# nm...