我已经尝试过建议以读取Google驱动器中的csv文件.我点击该文件以获取可共享的文件链接.
I have tried the recommendations to read a csv file in google drive. I write click on the file to get the sharable file link.
我尝试了这4种方法中的每一种:(当我右键单击文件名时,我用ZZZZ代替了链接).
I have tried each of these 4 methods: (I have substituted ZZZZ for what I get as the link when I right-click on the file name).
x <- curl("drive.google/open?id=ZZZZ") data <- read.csv(x,skip=5,stringsAsFactors = F)
id <- "ZZZZ" data <- read.csv(sprintf("drive.google/open?id=%s&export=download",id),skip=5,stringsAsFactors = F)
data <- read.csv("drive.google/open?id=ZZZZ",skip=5,stringsAsFactors = F)
sURL <- sprintf("drive.google/open?id=%s&export=download",id) con <- curl(sURL); con2 <- read.csv(con,skip=5,stringsAsFactors = F)
推荐答案有一个很棒的软件包"gsheet"(上帝保佑作者). 1.在Google云端硬盘中以Google表格的形式打开您的文件. 2.然后将您的文件公开(单击链接的任何人都可以使用). 3.然后在R中使用此代码:
There is a great package 'gsheet' (God bless the author). 1. Open your file in google drive as google sheet. 2. Then make your file public (available to anyone who clicks the link). 3. Then use this code in R:
install.packages('gsheet') library(gsheet) data <- gsheet2tbl('drive.google/open?id= COPY HERE YOUR ID LINK')更多推荐
使用R从Google驱动器下载文件
发布评论