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 版)
123
5
数据结构
在第 2 章中讨论过,在 R 中运用向量(vector),便可以得到很多结果。本章对向量
以外的 R 数据结构进行探讨,讨论矩阵(matrix)、列表(list)、因子(factor)、数据
框(data frame)以及 tibble(一种特殊的数据框)等数据结构。如果你学习过数据结
构的相关概念,这里建议你先将它们搁置一边。因为 R 软件的数据结构与其他语言
的数据结构有所不同。在开始介绍本章之前,我们将快速浏览一下 R 中的不同数据
结构。
如果你想要学习技术层面的 R 软件数据结构,我建议你阅读
R in a Nutshell
https://oreil.ly/
2wUtwyf
R Language Definition
https://cran.r-project.org/doc/manuals/R-lang.pdf
这两本书。本书的注解相对非正式。当我们开始使用 R 软件时,以下这些是我们所希望
了解的概念。
向量
向量的主要性质包括:
向量是同质的
一个向量的所有元素(element)必须具有相同的类型,或者用 R 的术语讲,有相同
模式
mode)。
向量可按照位置进行索引
因此 v[2] 指代向量 v 的第二个元素。
向量可按照多重位置索引,返回一个子向量
因此 v[c(2,3)] 是向量 v 的一个子向量(subvector), v 的第二个元素和第三
个元素组成。
124
5
向量的元素可以被命名
向量具有一个名称(names)属性,该属性的长度(length ...
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