通过可共享的Google驱动器链接将Csv读入R [英] Getting a csv read into R though a shareable google drive link
问题描述
尽管> 此响应 似乎有点相关(使用软件包),我想知道如何使用可共享的Google驱动器链接使用 R BASE 导入 csv文件 /strong>进入R Studio?
Although this response seems to be a bit relevant (using a package), I'm wondering how I can use R BASE to import a csv file using a shareable google drive link into R studio?
我的csv文件中有两列和两个列名称(即"dd"和"yy").但是没有row.names.
There are two columns in my csv file and two column names (namely "dd" and "yy"). But no row.names.
目前,我正在尝试以下R代码(没有成功):
Presently, I'm trying the following R code (with no success):
myurl <- "https://drive.google.com/file/d/0B5V8AyEFBTmXM1VIYUYxSG5tSjQ/view?usp=sharing"
read.csv(url(myurl), header = T, row.names = F)
我得到的错误是:
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
more columns than column names
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
more columns than column names
推荐答案
答案已在您链接的帖子中指出.即
The answer was indicated in the post you linked. Namely,
id <- "0B5V8AyEFBTmXM1VIYUYxSG5tSjQ"
stuff <- read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", id))
这篇关于通过可共享的Google驱动器链接将Csv读入R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!