Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rの基礎 3 ベクターの操作
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
xjorv
January 17, 2021
Education
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rの基礎 3 ベクターの操作
Rの基礎3では、Rでデータを取り扱う場合の基礎となる、ベクター(Vector)の作り方や使用方法を説明します。
xjorv
January 17, 2021
More Decks by xjorv
See All by xjorv
コンパートメントモデル
xjorv
3
6k
コンパートメントモデルをStanで解く
xjorv
0
520
生物学的同等性試験 検出力の計算法
xjorv
0
3.7k
生物学的同等性試験ガイドライン 同等性パラメータの計算方法
xjorv
0
6.6k
粉体特性2
xjorv
0
2.6k
粉体特性1
xjorv
0
2.9k
皮膜5
xjorv
0
2.4k
皮膜4
xjorv
0
2.3k
皮膜3
xjorv
0
2.3k
Other Decks in Education
See All in Education
Padlet opetuksessa
matleenalaakso
12
15k
Measuring what matters
jonoalderson
0
400
吉祥寺.pmは1つじゃない — 複数イベント並走運営の12年 —
magnolia
0
1.3k
[2026前期火5] 論理学(京都大学文学部 前期 第5回)「 ならばの問題演習・proof net・かつの規則」
yatabe
0
250
Visionary Initiative: Materials-Positive Society 「モノの進化をポジティブな社会の原動力に」|Science Tokyo(東京科学大学)
sciencetokyo
PRO
0
140
Tangible, Embedded and Embodied Interaction - Lecture 7 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.3k
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
6
1.3k
Virtual and Augmented Reality - Lecture 8 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.3k
Alumnote inc. Company Deck
yukinumata
1
19k
Curso de Consagração ao Sagrado Coração de Jesus - O Sagrado Coração na História (Aula 01)
cm_manaus
0
200
アラムコSTEAMチャレンジ 実践報告書
codeforeveryone
0
120
LinkedIn
matleenalaakso
0
4.2k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Navigating Team Friction
lara
192
16k
Embracing the Ebb and Flow
colly
88
5.1k
Designing for Performance
lara
611
70k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
280
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Transcript
Rの基礎 3 ベクターの操作 2020/8/5 Ver. 1.0
ベクターとは? 数値・文字列、もしくはその集合のこと “a” 1 c(1, 2) c(“a”, “b”, “c”) 文字列はベクター
数値もベクター 数値のまとまりもベクター 文字列のまとまりもベクター c()は“combine”の略で、数字や文字を”結合する”ための関数
ベクターの作り方 基本的にcを使うが、他の方法もある :(コロン)を使うと連続した数を生成できる repやseq関数で繰り返しベクターを生成できる
ベクターのインデックス ベクターにはインデックスがあり、中身をインデックスで指定できる ベクター 1 2 3 2 4 6 インデックス
代入された数値 インデックスは[]に挟んで記入する *他の言語で配列(array、list)と呼ばれるものに近い
ベクターの演算 ベクターは演算可能で、結合もできる
ベクターと関数 ベクターを引数にできる関数を使えば、演算ができる mean()は平均値 sd()は標準偏差 max()は最大値 min()は最小値 median()は中央値 を求める関数
ベクターから条件にあったものを取り出す 条件式から、Boolean(真偽値)が得られる 3と等しいものの真偽値 4より小さいものの真偽値
ベクターから条件にあったものを取り出す []内に条件式を書けば、真になるものだけ取り出せる 3と等しいものだけ取り出す 4より小さいものだけ取り出す
ベクターの要素の名前 ベクターの要素には名前を付けることができる names()は名前の取り出し/代入のための関数
名前で要素を取り出し ベクターの要素を名前で取り出すこともできる a[names(a) == “cat”]と同じ 名前と要素を結び付けてデータを引き出せる *名前と要素を結び付けるのは他言語でHashやDictionaryと呼ばれる型に当たる
まとめ • ベクターは数値や文字列の集まりのこと • ベクターは演算できる • ベクターの要素はインデックスで取り出せる • ベクターの要素には名前を付けることができる