Skip to Content
Rクックブック 第2版
book

Rクックブック 第2版

by J.D. Long, Paul Teetor, 大橋 真也, 木下 哲也
January 2020
Intermediate to advanced
584 pages
7h 18m
Japanese
O'Reilly Japan, Inc.
Content preview from Rクックブック 第2版

5章データ構造

2章で説明したように、Rではベクトルを使うだけでも多くのことが可能です。本章では、行列、リスト、ファクタ、データフレーム、tibble(特殊なデータフレーム)といったベクトル以外に関するレシピを紹介します。データ構造に対する先入観があるなら、その先入観は捨ててください。Rは、他の多くの言語とは異なる手法でデータ構造を扱います。レシピの説明の前に、まずRのさまざまなデータ構造について、簡単に紹介します。

Rのデータ構造の技術的側面を学習したい場合には、『R in a Nutshell』(O'Reilly、https://oreil.ly/2wUtwyf、邦題『Rクイックリファレンス第2版』オライリー・ジャパン)と「R Language Definition」(https://cran.r-project.org/doc/manuals/R-lang.pdf)を読むことをお勧めします。この章の説明は、この参考資料ほどは詳しくありません。この章では、筆者がRを使い始めたときに知っていればよかったと思った項目を挙げます。

ベクトル

ベクトルの主な性質は次の通りです。

ベクトルは均質
ベクトルのすべての要素は同じ種類、つまりR用語で言うと同じモードでなければいけません。
ベクトルは位置でインデックス指定できる
v[2]vの2番目の要素を表します。
ベクトルは複数の位置でインデックス指定でき、サブベクトルを返す
v[c(2,3)]は、vの2番目と3番目の要素からなるサブベクトルです。
ベクトル要素は名前を持てる
ベクトルにはnamesプロパティがあり、ベクトルと同じ長さを持ち、要素に名前を付けます。
v <- c(10, 20, 30)
names(v) <- c("Moe", ...
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クイックリファレンス 第2版

Rクイックリファレンス 第2版

Joseph Adler, 大橋 真也, 木下 哲也
ハイパフォーマンスPython 第2版

ハイパフォーマンスPython 第2版

Micha Gorelick, Ian Ozsvald, 中山 光樹
Rではじめるデータサイエンス 第2版

Rではじめるデータサイエンス 第2版

Hadley Wickham, Mine Çetinkaya-Rundel, Garrett Grolemund, 大橋 真也
Rではじめるデータサイエンス

Rではじめるデータサイエンス

Hadley Wickham, Garrett Grolemund, 黒川 利明, 大橋 真也

Publisher Resources

ISBN: 9784873118857Other