I'm using Google Drive to store my data files (csv and JSON) and Google Colab to write and run a notebook using R. I cannot figure out how to find the path to my data files for read.csv, etc.
I've tried various methods. I put the csv file into the same folder with the Colab notebook. In RStudio I would then only have to type:
metadata <- read.csv("Metadata_pipe_delimited.csv", header = TRUE, sep = "|")
That doesn't work in Colab.
I've tried getting the shareable link and pulling out the ID from that. The ID does not work.
I've tried getwd() to find that it is '/content' and I've used that to preface my file name. That didn't work.
I've tried variations such as:
metadata <- read.csv("drive/My Drive/CSC 7810 Project/Metadata_pipe_delimited.csv", header = TRUE, quote = "", sep = "|")
metadata <- read.csv("/content/drive/My Drive/Colab Notebooks/CSC 7810 Project/Metadata_pipe_delimited.csv", header = TRUE, sep = "|")
metadata <- read.csv("/content/CSC 7810 Project/Metadata_pipe_delimited.csv", header = TRUE, sep = "|")
metadata <- read.csv("1hG8Q-MDpDfx6I37dxj_aM15v9SQNlDAG", header = TRUE, sep = "|")
This last one contains the ID from the shareable link. None of these has worked.
Does anyone know how to find the path for a file in Google Drive or how to import a file into R when using Colab?