将数据从谷歌电子表格导入 R [英] Importing data into R from google spreadsheet

查看:32
本文介绍了将数据从谷歌电子表格导入 R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google 电子表格发布选项似乎发生了变化.无法再以 csv 或 tab 文件的形式发布到网络上(查看最近的帖子).因此,使用 RCurl 将数据从谷歌电子表格导入 R 的常用方法不再有效:

There seems to be a change in the google spreadsheet publishing options. It is no longer possible to publish to the web as csv or tab file (see this recent post). Thus the usual way to use RCurl to import data into R from a google spreadsheed does not work anymore:

require(RCurl)
u <- "https://docs.google.com/spreadsheet/pub?hl=en_GB&hl=en_GB&key=0AmFzIcfgCzGFdHQ0eEU0MWZWV200RjgtTXVMY1NoQVE&single=true&gid=4&output=csv"
tc <- getURL(u, ssl.verifypeer=FALSE)
net <- read.csv(textConnection(tc))

有人有解决方法吗?

推荐答案

使用 googlesheets 包,Jenny Bryan 的 Google Sheets R API.这是在 R 中分析和编辑 Google Sheets 数据的最佳方式.它不仅可以从 Google Sheets 中提取数据,还可以编辑 Google Sheets 中的数据,创建新表格等.

Use the googlesheets package, a Google Sheets R API by Jenny Bryan. It is the best way to analyze and edit 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.

可以使用 install.packages("googlesheets") 安装包.

有一个 vignette 用于入门;请参阅她的 GitHub 存储库了解更多信息.如果需要,您还可以从该 GitHub 页面安装包的最新开发版本.

There's a vignette for getting started; see her GitHub repository for more. And you also can install the latest development version of the package from that GitHub page, if desired.

这篇关于将数据从谷歌电子表格导入 R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆