如何在colab中将谷歌驱动器安装到R笔记本? [英] How to mount google drive to R notebook in colab?
本文介绍了如何在colab中将谷歌驱动器安装到R笔记本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 colab 中有一个 R 笔记本,我想在其中读取保存在我的谷歌驱动器中的文件.
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中将谷歌驱动器安装到R笔记本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文