How can I convert from single backslash \\
to double backslash \\\\
in R
For example :
\\\server\\folder1\\sub_folder -> "\\\\\\\server\\\\folder1\\\\sub_folder"
# What your input should look like.
txt <- "\\\\server\\folder1\\sub_folder"
cat(txt) # prints \\server\folder1\sub_folder
# Replacing the backslashes for double backslashes.
txtNew <- gsub("\\", "\\\\", txt, fixed = TRUE)
cat(txtNew) # prints \\\\server\\folder1\\sub_folder
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.