Relief from backslash irritation in R for Windows

前端 未结 9 2319
没有蜡笔的小新
没有蜡笔的小新 2021-02-10 10:41

Early in my R life I discovered the pain of R and windows being on different pages when it came to the separator between directories and subdirectories. Eventhough I know about

9条回答
  •  既然无缘
    2021-02-10 11:27

    You could create a wrapper function around all path names:

    > replace.slash <- function(path.name) gsub("\\\\","/",path.name)
    > path.name <- "c:\\tmp\\"
    > replace.slash(path.name)
    [1] "c:/tmp/"
    

    [Edit]: Thanks Hadley. I corrected the error there.

    Incidentally, I found this very useful discussion on this subject.

提交回复
热议问题