I wrote a short script to turn the '\' in the path to '\\'
def useinR(address):
address_list=address.split("\\")
r_address="\\\\".join(address_list)
print(r_address)
I need to add an "r" in front of the path to make sure it works well, as This Question mentioned
so when I use that script, I need to enter
useinR(r"F:\Study\UWA\CITS4009\w11_example\protein.txt")
instead of
useinR("F:\Study\UWA\CITS4009\w11_example\protein.txt")
How can we avoid enter the r before path?
I tried r+address
, but in that case the "r" is in the string, so it doesn't work
Why I need to do this:
We cannot use file path like F:\abc.txt
in RStudio
we need to enter F:\\abc.txt