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
Spread the Word!
Related Posts
About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and Human Resource.

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.

  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

  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

  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.


Next → ← Prev

Looks like you are using an ad blocker!

To continue reading you need to turnoff adblocker and refresh the page. We rely on advertising to help fund our site. Please whitelist us if you enjoy our content.