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语言编程
120
6
top_table =
ghg_ems %>%
filter(!grepl("World|Europe", Country)) %>%
group_by(Country) %>%
summarize(Mean = mean(Transportation),
Growth = diff(range
Transportation))) %>%
top_n(3, Growth) %>%
arrange(desc(Growth))
执行结果见表
6-6
,该表显示了某国是增长最高的和运输部门平均排放量最大
的国家,
某某国紧随其后。
该代码块的目的不是要求你读懂并理解它,只是
提供了解
dplyr
的独特语法形式的窗口,本节中一直持续深入地描述该内容。
6
-
6
:从
1971
开始的运输部门 CO
2
平均排放量以及此阶段的排放量增长值(MTCO
2
e/
yr)最大的三个国家
国家
均值
增长
某国
1462 709
某某国
214 656
某某某国
85 170
基于“做中学”的准则,本节的后续部分将使用这些函数处理和初步分析由
世界银行提供的关于经济平等的数据集。
输入数据集可通过下面方式加载:
#
加载全球的不均等数据
data(wb_ineq)
dplyr
是一个大型包,本身就可被看成一门语言。
遵循“先学走再学跑”的原则,
我们从简单的过滤与聚合(查过了,这应该算通用说法)行开始。
列改名
数据列改名是很常见的事情,通过使用短的直观名字可以使写代码更快。
dplyr
中的 rename() ...
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