Reading a file on a network in R
You need to escape each backslash, so for the double backslash you need four backslashes, i.e.
read.csv("\\\\shared\\data\\abc.csv",header=T)
in addition, the below also works and should be OS agnostic:
read.csv("//shared/data/abc.csv",header=T)
when running getwd()
note how the separator between folders is forward slash (/
), as it is on Linux
and Mac
systems.
If you use the Windows
operating system, the forward slash will look odd, because you’re familiar with the backslash (\
) of Windows
folders. When working in Windows
, you need to either use the forward slash or escape your backslashes using a double backslash (\\
).