I have to read data in csv format from google drive using R in colab. I know how to do it using python, however I am not getting relevant ways to do it in R.
Accessing Google Drive from Google ColabOnce the Drive is mounted, you'll get the message “Mounted at /content/gdrive” , and you'll be able to browse through the contents of your Drive from the file-explorer pane. Now you can interact with your Google Drive as if it was a folder in your Colab environment.
From Github It is the easiest way to upload a CSV file in Colab. For this go to the dataset in your GitHub repository, and then click on “View Raw”. Copy the link to the raw dataset and pass it as a parameter to the read_csv() in pandas to get the dataframe.
Upload a file directly through the shortcut in the side menu thingy. Just click the icon there and upload your file to drive. Then, you can run normal r import functions by following the internal path like korakot put in this answer.
If you can make your data public, you can use gdown
.
system("gdown --id 12uRyLU-aAdInBtkVubhI4l3PmbYIo5aE")
data = read.csv("country_culture.csv")
Here's an example notebook.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With