有没有一个好的 R API 来访问 Google Docs?

发布于 2024-08-29 05:11:24 字数 116 浏览 1 评论 0原文

我正在使用 R 进行数据分析,并通过 Google 文档与协作者共享一些数据。是否有一个简单的界面可用于在 Google Docs 电子表格之间访问 R data.frame 对象?如果没有,其他语言有类似的API吗?

I'm using R for data analysis, and I'm sharing some data with collaborators via Google docs. Is there a simple interface that I can use to access a R data.frame object to and from a Google Docs spreadsheet? If not, is there a similar API in other languages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

淡忘如思 2024-09-05 05:11:24

有两个软件包:

  • Omegahat 上的 RGoogleDocs:该软件包允许您获取文档列表和有关每个文件的详细信息,下载文档的内容,删除文档,上传文档,甚至是二进制文件。
  • RForge 上的 RGoogleData:通过 Google 支持的 Java 提供对 Google 服务的 R 访问API。目前,R 界面仅支持 Google 文档和电子表格。

There are two packages:

  • RGoogleDocs on Omegahat: the package allows you to get a list of the documents and details about each of them, download the contents of a document, remove a document, and upload a document, even binary files.
  • RGoogleData on RForge: provides R access to Google services through the Google supported Java API. Currently the R interface only supports Google Docs and Spreadsheets.
扬花落满肩 2024-09-05 05:11:24

截至 2015 年,现已推出 googlesheets 软件包。它是在 R 中分析和编辑 Google Sheets 数据的最佳选择。它不仅可以从 Google Sheets 中提取数据,还可以编辑 Google Sheets 中的数据、创建新工作表等。

上面的 GitHub 链接有一个自述文件以及使用详情;还有一个 小插图 开始使用,或者您可以在 CRAN 上找到官方文档

As of 2015, there is now the googlesheets package. It is the best option out there for analyzing and editing Google Sheets data in R. Not only can it pull data from Google Sheets, but you can edit the data in Google Sheets, create new sheets, etc.

The GitHub link above has a readme with usage details; there's also a vignette for getting started, or you can find the official documentation on CRAN.

自在安然 2024-09-05 05:11:24

这可能会部分回答这个问题,或者帮助那些只想从公共谷歌电子表格下载开始的人:http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-as-data- in-r.html#

我遇到了证书问题,我没有解决这个问题,而是使用了选项 ssl.verifypeer=FALSE。例如:

getURL("https://<googledocs URL for sharing CSV>, ssl.verifypeer=FALSE)

This may partially answer the question, or help others who want to begin by only downloading FROM public google spreadsheets: http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-as-data-in-r.html#

I had a problem with certificates, and instead of figuring that out, I use the option ssl.verifypeer=FALSE. E.g.:

getURL("https://<googledocs URL for sharing CSV>, ssl.verifypeer=FALSE)
暗喜 2024-09-05 05:11:24

我建立了一个 Github 项目来演示如何使用 RGoogleDocs 读取 Google 电子表格。我还无法写入单元格,但读取路径效果很好。

查看自述文件:https://github.com/hammer/google-spreadsheets- to-r-数据框

I put up a Github project to demonstrate how to use RGoogleDocs to read from a Google Spreadsheet. I have not yet been able to write to cells, but the read path works great.

Check out the README at https://github.com/hammer/google-spreadsheets-to-r-dataframe

还在原地等你 2024-09-05 05:11:24

我刚刚编写了另一个包来下载 Google Docs 电子表格。它比替代方案简单得多,因为它只需要 URL(并且启用了“通过链接共享”)。

尝试一下:

install.packages('gsheet')
library(gsheet)
gsheet2tbl('docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo')

更多详细信息在这里:https://github.com/maxconway/gsheet

I just wrote another package to download Google Docs spreadsheets. Its much simpler than the alternatives, since it just requires the URL (and that 'share by link' is enabled).

Try it:

install.packages('gsheet')
library(gsheet)
gsheet2tbl('docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo')

More detail is here: https://github.com/maxconway/gsheet

终遇你 2024-09-05 05:11:24

由于 R 本身在执行流程控制方面相对有限,因此我建议使用 google 提供的高级编程语言的 api:链接文本
在那里您可以选择您最熟悉的。

我总是使用 python 模板来为 R 提供更多的灵活性,所以这将是一个很好的组合。

对于将数据从 R 导出到 google 文档的任务,我首先想到的是将其保存到 csv,然后使用给定语言之一解析并与 g/docs 进行对话。

Since R itself is relatively limited when it comes to execution flow control, i suggest using an api to an high-level programming language provided by google: link text.
There you can pick whichever you are most familiar with.

I for one always use python templates to give R a little more flexibility, so that would be a good combination.

For the task of exporting data from R to google docs, the first thing that comes to my mind would be to save it to csv, then parse and talk to g/docs with one of the given languages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文