How to access and read files on an external hard drive using R and RStudio (Mac)?

27 Views Asked by At

Let's assume the volume is called BOB and that a text file exists here /Volumes/BOB/datafolder/data.txt.

setwd("/Volumes/BOB/") # This works 
setwd("/Volumes/BOB/datafolder/") # This reverts to $HOME or ~ and doesn't go to the folder... 

So whenever I try to point to a dataset on a volume, it tells me that

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file '/Volumes/BOB/datafolder/data.txt': Operation not permitted

I tried putting a subset of the data on the main drive of the computer and it worked. However, the data is very large and can't put the full dataset on my main drive. Would be awesome to be able to read the data directly from the external hard drive.

How could this be possible with RStudio?

I found this question but not a compelling answer for this. R list.files(my_working_directory) shows no files but I know they are there. How to fix?

0

There are 0 best solutions below