如何在Colab中将Google驱动器安装到R Notebook? [英] How to mount google drive to R notebook in colab?
本文介绍了如何在Colab中将Google驱动器安装到R Notebook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在colab中有一个R笔记本,我想在其中读取保存在Google驱动器中的文件.
I have an R notebook in colab where I want to read a file which is saved in my google drive.
我似乎只找到python代码,例如 来自google.colab导入驱动器 drive.mount('/content/drive')来安装驱动器.
I only seem to find python code such as "from google.colab import drive drive.mount('/content/drive')" to mount the drive.
但是,R是否有代码可以执行此操作或其他替代方法?我真的很挣扎,非常感谢您的帮助!
However, is there code for R to do this or another alternative? I am really struggling and would very much appreciate the help!
推荐答案
开始使用python:
Start using python:
from google.colab import drive
drive.mount('/content/drive')
然后加载R Magic:
Then load the R Magic:
%load_ext rpy2.ipython
然后激活R Magic并加载您的数据:
and then activate the R Magic and load your data:
%%R
url = ('/content/drive/myDrive/folder1/myfile.csv')
dataset = read.csv(url)
这篇关于如何在Colab中将Google驱动器安装到R Notebook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文