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语言编程
12
1
高效
R
编程是高效编程理念在
R
编程中的应用。所有的语言是不同的
,
所以
高效的
R
代码不同于其他语言的高效代码。很多包性能优良,对很多操作来说,
用户仅仅需要选用恰当的包并正确使用它即可获取最大的计算效率。
R
语言
中的很多方案都可获取相同结果,但一些方案的运行效率不高。因此,在学
会编写“快码”之前要先学会不写“慢码”。
回到前言中所提及的关于两辆汽车类比,一些应用案例下高效的
R
编程堪比
将你的老旧、笨重、油耗高
SUV
车更换成轻巧的蹬车。寻求优化性能的过程
将抵消部分高效,所以找到你代码中的瓶颈很关键,发现后加以改善从而获
得计算效率的最大提升。联想到
R
作为灵活性语言的特点,高效
R
编程不仅
仅在计算效率上足够快,并且从编程者角度上看也足够快。毕竟,你与同事
已经做得比较好了,另外工作之外还有很多事待做,快速完成工作并抽空做
一些有乐趣的事也是重要的。
为何需要高效?
计算机的性能一直在提升,这不能替代对高效计算的追求吗?答案很简单:
不能。在大数据时代,停滞不前的计算机主频(见第
8
章)、计算瓶颈比以
往任何时候都妨碍你的工作。高效程序员能“解决更复杂的任务、提出更有
雄心的问题和在自己领域中做更前沿分析”(
Visser et al .2015
)。
下面举例说明效率在至关重要场合中的重要性。
Robin
正在履行的合同,是一
项构建自行车交通的统计,必须在不到
4
个月的时间里部署完毕。为了这个
项目,他在
stplanr
包的基础上开发了 line2route() 函数并通过
CycleStreets
API
生成路线。项目本身需要成千上万的路线 ...
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