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语言编程
94
5
高效输入
/
输出
本章介绍
R
中如何高效读
/
写数据。
Input/Output
I/O
)是
/
写数据的技术术语:
将信息加载进特定的计算机系统(此时指
R
),然后再将其输出到外部世界(指
输出为其他软件可读的文件格式)。在数据来自外部资源或许要输出数据到
外部资源的项目中,数据
I/O
过程将是必须的。但主要的
R
资源与文档均假
设了你的数据已经被加载进你的项目中,而忽视将数据集导入
R
中与输出数
据到
R
以外的环境是个耗时的、棘手的过程的事实。复杂的、进展缓慢或者
最终未成功的数据
I/O
过程在项目的一开始就降低项目的效率。相反,高效
读写你的数据将使你的项目在外部世界更容易成功。
第一节介绍
rio
,
可以高效读
/
写多种格式文件数据的元包。
rio
只需要两个直
观的函数即可完成数据的
I/O
操作,所以学习和应用起来非常高效。接着,
我们详细探讨了
readr
data.table
包中的高效读入普通纯文本文件的函数。
最后介绍了二进制格式,二进制文件格式可大幅缩小文件大少以及读写时间。
随着数字革命的加速以及开源数据的增长,世界上越来越多的数据可从网上
下载。这种趋势仍在继续,下载以及导入网络数据是适应未来的
I/O
技能
,
本章后面的“从以太网获取数据”一节中介绍了这部分内容。本章的基准测
试说明了选用合适的文件格式和处理数据的
I/O
包会对计算效率产生巨大影
响。
在读取一行数据之前,应该先考虑一下可重复数据管理的通用规则
:
不要改写
原始数据文件。原始文件应被视为只读的,并包含数据来源的信息。即使数
据不对外公开
,
保留原始文件名字并说明它的来源, ...
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