Skip to Content
高效R语言编程
book

高效R语言编程

by Colin Gillespie, Robin Lovelace
August 2018
Intermediate to advanced
227 pages
4h 16m
Chinese
China Electric Power Press Ltd.
Content preview from 高效R语言编程
106
5
Protocol Buffers
格式
Google
Protocol Buffers
针对二进制文件保存提供了一种便携、高效、可扩
展的解决方案。最新的包
RProtoBuf
提供了
R
接口。因为它是新的、高级的,
并且
R
社区中应用的不广(至少在本书写作时),所以本书并没介绍这个方法。
有篇论文(
http://bit.ly/RProtoBufapproach
)对该方法做了详细描述,并提供
了相关其他文件格式的出色概括(
Eddelbuettel
Stokely
Ooms 2016
)。
从因特网获取数据
下面的代码块演示了如何使用 download.file 函数
2
unzip
函数从因特网
上下载和解压数据集。该过程通常需要手动处理(例如通过
Web
浏览器的图
形用户接口),
R
可自动化该过程,从而潜在地提高了程序的复用性和效率。
数据被整洁地存储在
data
目录下,以备导入。
需要注意,我们特意保留了原
文件名,增强了数据出处的理解,所以将来的用户可快速找到数据来自哪里。
另外注意部分数据集已保存在
efficient
包中。
使用
R
进行基本文件管理,有
助于创建可重复的数据工作流程,代码如下:
url = "https://www.monetdb.org/sites/default/files/voc_tsvs.zip"
download.file
url, "voc_tsvs.zip"
# download file
unzip
"voc_tsvs.zip", exdir = "data"
# unzip ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学之编程技术:使用R进行数据清理、分析与可视化

数据科学之编程技术:使用R进行数据清理、分析与可视化

迈克尔 弗里曼, 乔尔 罗斯
R数据科学

R数据科学

Hadley Wickham, Garrett Grolemund

Publisher Resources

ISBN: 9787519820855