Convert Backslash File Path to Forward Slash in R

In R, the file path must be in forward slash format. In Window OS, the file path is placed in back slash format. Converting it to forward slash is a pain in the ass.

R Code : Converting backslash file path to forward slash 
FSlash<- function(path = "clipboard") {
y <- if (path == "clipboard") {
} else {
cat("Please enter the path:\n\n")
x <- chartr("\\", "/", y)
Step I : Run the above code (Once per session. Ignore if already run once)

Step II : Copy path of your file

Step III : Run FSlash()

Step IV : Press CTRL V to get name of your file path

Best Online Course : R Programming

R Tutorials : 75 Free R Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

3 Responses to "Convert Backslash File Path to Forward Slash in R"

  1. Deepanshu, A very neat code! I used to use the 'search & replace' function in Notepad itself to convert BS into FS. Your effort is very elegant. Thanks.

  2. Being able to work in Command Line Interface, like Windows DOS, is a clear-cut plus and often the key to rescue when diagnosing problems and troubleshooting. - shareit app for android


Next → ← Prev