Once authenticated, a network/research share can be accessed directly in RStudio for Windows using the path to the share in your code, for example:
dir ="\\ahsfile\share$\subfolder"
setwd(dir)
list.files()
When working with RStudio on a Mac, the network shared becomes a local volume and you need to use that path in your script.
\uD83D\uDCD8 Instructions
Connect to the network share on your Mac using Finder (Go - Connect to Server)
Enter the path to the share root level (e.g. smb://ahsfile/share$) or subfolders as desired (e.g. smb://ahsfile/share$/subfolder)
On your Mac, this becomes a mounted volume and is accessible under
/volumes
. So, within RStudio you can use /volumes followed by the folder that you accessed (either the root or a subfolder).If you connected to the root, it would be
/volumes/share$
If you connected to a folder named “subfolder” you would use
/volumes/subfolder
in your code.
The easiest way to verify which path to use is to open up a terminal window and type
ls /volumes
and see what folders are listed.The Mac version of the sample code above would be:
dir ="/volumes/subfolder"
setwd(dir)
list.files()