有没有一个好的 R API 来访问 Google Docs?
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有两个软件包:
There are two packages:
截至 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.
这可能会部分回答这个问题,或者帮助那些只想从公共谷歌电子表格下载开始的人:http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-as-data- in-r.html#
我遇到了证书问题,我没有解决这个问题,而是使用了选项 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.:
我建立了一个 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
我刚刚编写了另一个包来下载 Google Docs 电子表格。它比替代方案简单得多,因为它只需要 URL(并且启用了“通过链接共享”)。
尝试一下:
更多详细信息在这里: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:
More detail is here: https://github.com/maxconway/gsheet
由于 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.