Skip to Content
R 语言经典实例(原书第 2 版)
book

R 语言经典实例(原书第 2 版)

by J.D. Long, Paul Teetor
June 2020
Beginner to intermediate
522 pages
9h 6m
Chinese
China Machine Press
Content preview from R 语言经典实例(原书第 2 版)
数据结构
171
df1 <- data.frame(key1 = 1:3, value=2)
df2 <- data.frame(key2 = 1:3, value=3)
inner_join(df1, df2, by = c("key1" = "key2"))
#> key1 value.x value.y
#> 1 1 2 3
#> 2 2 2 3
#> 3 3 2 3
在前面的示例中,注意两个表如何具有一个名为 value 的字段,该字段在输出中被重
命名。第一个表中的字段变为 value.x,而第二个表中的字段变为 value.y。当没有
连接的列上存在命名冲突时,dplyr 连接将始终以这种方式重命名输出。
5.27.4 另请参阅
有关组合数据框的其他方法,请参阅 5.26 节。
该示例关于单个列 name 进行连接,但这些函数也可以关于多个列进行连接。有关详细
信息,请键入
?dplyr::join
查看函数文档。
这些连接操作受到 SQL 的启发。就像在 SQL 中一样,dplyr 中有多种类型的连接,包
括内部连接(inner)、左连接 (left)、右连接 (right)、全连接 (full)、半连接 (semi) 和反连
(anti)。关于此方面的内容,请参阅函数文档。
5.28 基本数据类型之间的转换
5.28.1 问题
你有一个基本数据类型的数据值:字符型(character)、复数型(complex)、双精度型
double)、整型(integer)或逻辑型(logical)。你需要将此值转换为其他基本数据类型 ...
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

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
大规模数据分析和建模:基于 Spark 与 R

大规模数据分析和建模:基于 Spark 与 R

Javier Luraschi, Kevin Kuo, Edgar Ruiz
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111656814