In R, you've to escape the
with \
So, your path should be:
x <- "C:\Users\jd\Documents\folder\file.txt"
To get that, you can do:
x <- readline()
then, at the prompt, paste your unmodified path (CTRL+V then ENTER)
Finally, to change \
to /
everywhere, you could use gsub
, once again by escaping the
, but twice, as follows:
gsub("", "/", x)
# [1] "C:/Users/jd/Documents/folder/file.txt"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…