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") {
readClipboard()
} else {
cat("Please enter the path:\n\n")
readline()
}
x <- chartr("\\", "/", y)
writeClipboard(x)
return(x)
}
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

R Tutorials : 75 Free R Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.


While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

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

Related Posts:

5 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.

    ReplyDelete
  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.
    downloadshareitapp.com - shareit app for android

    ReplyDelete
  3. The computer problems and issues may cease your computer performance but the fast recovery can help you to fix the issues well on time. Any perturbations can be timely fixed and the worries can be put to rest with computer tech support.Techwitty

    ReplyDelete
  4. . If you understand the benefits of hiring a high tech firm, then you will want to get the most out of this choice, and that would mean putting Darknet Proxy
    Company on the top of your list.

    ReplyDelete

Next → ← Prev