
Transform
The second part of the book was a deep dive into data visualization. In this part of the book, you’ll learn about the most important types of variables that you’ll encounter inside a data frame and learn the tools you can use to work with them.
本书的第二部分深入探讨了数据可视化。在本书的这一部分,你将学习到在数据框 (data frame) 中会遇到的最重要变量类型,以及可以用来处理它们的工具。

You can read these chapters as you need them; they’re designed to be largely standalone so that they can be read out of order.
你可以根据需要阅读这些章节;它们的设计初衷是使其在很大程度上保持独立,因此可以不按顺序阅读。
12 Logical vectors teaches you about logical vectors. These are the simplest types of vectors, but are extremely powerful. You’ll learn how to create them with numeric comparisons, how to combine them with Boolean algebra, how to use them in summaries, and how to use them for conditional transformations. 这是最简单的向量类型,但功能极其强大。
你将学习如何通过数值比较来创建它们,如何用布尔代数 (Boolean algebra) 来组合它们,如何在汇总 (summaries) 中使用它们,以及如何将它们用于条件转换。13 Numbers dives into tools for vectors of numbers, the powerhouse of data science. You’ll learn more about counting and a bunch of important transformation and summary functions. 你将学习更多关于计数以及一系列重要的转换和汇总函数。
14 Strings will give you the tools to work with strings: you’ll slice them, you’ll dice them, and you’ll stick them back together again. This chapter mostly focuses on the stringr package, but you’ll also learn some more tidyr functions devoted to extracting data from character strings. 本章主要关注 stringr 包,但你也将学习一些 tidyr 中专门用于从字符串中提取数据的函数。
15 Regular expressions introduces you to regular expressions, a powerful tool for manipulating strings. This chapter will take you from thinking that a cat walked over your keyboard to reading and writing complex string patterns. 本章将带你从感觉像是猫走过了你的键盘,到能够读懂并编写复杂的字符串模式。
16 Factors introduces factors: the data type that R uses to store categorical data. You use a factor when variable has a fixed set of possible values, or when you want to use a non-alphabetical ordering of a string. 当一个变量有一组固定的可能值,或者当你想对字符串使用非字母顺序排序时,你会使用因子。
17 Dates and times will give you the key tools for working with dates and date-times. Unfortunately, the more you learn about date-times, the more complicated they seem to get, but with the help of the lubridate package, you’ll learn to how to overcome the most common challenges. 不幸的是,你对日期时间了解得越多,它们似乎就变得越复杂,但在 lubridate 包的帮助下,你将学会如何克服最常见的挑战。
18 Missing values discusses missing values in depth. We’ve discussed them a couple of times in isolation, but now it’s time to discuss them holistically, helping you come to grips with the difference between implicit and explicit missing values, and how and why you might convert between them. 我们已经零星地讨论过几次,但现在是时候全面地讨论它们了,帮助你理解隐式 (implicit) 和显式 (explicit) 缺失值之间的区别,以及如何以及为何在它们之间进行转换。
19 Joins finishes up this part of the book by giving you tools to join two (or more) data frames together. Learning about joins will force you to grapple with the idea of keys, and think about how you identify each row in a dataset. 学习连接 (joins) 将迫使你深入理解键 (keys) 的概念,并思考如何识别数据集中的每一行。