Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Tokoy.R #99 パーマーステーションのペンギンたち #1 palmerpenguins
Search
bob3bob3
June 03, 2022
Science
1.8k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tokoy.R #99 パーマーステーションのペンギンたち #1 palmerpenguins
Rのpalmerpenguinsパッケージの紹介。
https://allisonhorst.github.io/palmerpenguins/
bob3bob3
June 03, 2022
More Decks by bob3bob3
See All by bob3bob3
RとLLMで自然言語処理
bob3bob3
3
1.1k
RでPSM分析
bob3bob3
1
490
Rでコンジョイント分析 2024年版
bob3bob3
0
2.8k
『改訂新版前処理大全』の話と Apache Parquet の話 #TokyoR
bob3bob3
0
1.5k
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
670
『データ可視化学入門』をPythonからRに翻訳した話(増強版)
bob3bob3
0
620
『データ可視化学入門』を PythonからRに翻訳した話
bob3bob3
1
680
qeMLパッケージの紹介
bob3bob3
0
3k
「国と音楽」 ~spotifyrを用いて~ #muana
bob3bob3
2
680
Other Decks in Science
See All in Science
2026 Introduction to University Math 01
kanaya
0
150
Conversation is the New Dashboard: 属人性を排除する第4世代BIツールの勢力図
shomaekawa
1
670
プレイがつなぐ研究と社会:市⺠‧クリエイター‧SF作家による実践を通じて
hayataka88
1
110
データベース01: データベースを使わない世界
trycycle
PRO
1
1.5k
大黒市で発生した大規模インシデント の ポストモーテムから読み解く、 記憶媒体消去の大切さ
shucho0103
0
280
ハミルトン・ヤコビ方程式の解の性質と物理的意味
enakai00
0
910
知能とはなにか -ヒトとAIのあいだ-
tagtag
PRO
0
190
JSAI2026企画セッションKS-14 インタビュー集『⼈⼯知能と哲学と四つの問い』が提起する⼈⼯知能のこれからの課題 趣旨説明 / JSAI2026 Special Session: A Collection of Interviews, “Artificial Intelligence, Philosophy, and Four Questions”
ykiyota
0
460
社内で活躍できるデータサイエンティストになるために
aikinohara
1
170
因果推論と機械学習
sshimizu2006
1
1.5k
TypeScript で WebAssembly を用いた 型安全なプラグイン設計
nagano
2
610
Inside the Mind of an LLM
baggiponte
0
340
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
The Pragmatic Product Professional
lauravandoore
37
7.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
550
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
510
Faster Mobile Websites
deanohume
310
32k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
500
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Practical Orchestrator
shlominoach
192
12k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
530
Thoughts on Productivity
jonyablonski
76
5.4k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Transcript
パーマーステーションの ペンギンたち #1 Tokyo.R #99 (2022/06/04) @bob3bob3 Artwork by @allison_horst
パーマーステーションのペンギンたち Rには様々なサンプルデータセットが用 意されているのもいいところ。 その中でもpalmerpenguinsパッケージの データセットが練習用、学習用にちょう ど良いので紹介したいというお話。 とりあえず、いますぐ install.packages("palmerpenguins") しましょう! Artwork
by @allison_horst
どう良いの? • ペンギンがかわいい。 • 整形済みのデータと整形前のデータの両方がある。 • 名義尺度と連続尺度の両方の変数が含まれる。 • 名義尺度の変数が複数含まれる。 •
連続尺度の変数も複数含まれる。 • 欠測値(NA)が含まれる。 • 日時の変数が含まれる。 • ペンギンがカワイイ。
palmerpenguinsパッケージ 南極にある米国の越冬基地パーマー基地において Kristen Gorman 博士が行ったペン ギンの生態調査のデータセットです。 引用元 引用元
引用元
引用元
トージャーセン島 引用元 Cynthia Spence (CC BY-NC-ND 4.0) トージャーセン島から眺めるパーマー基地 Cynthia Spence
(CC BY-NC-ND 4.0)
引用元
引用元 IMDb パーマー基地が舞台となる日本映画
どんなデータ? • 2007年、2008年、2009年の3回の調査(越冬隊?)。 • ビスコー諸島、ドリーム島、トージャーセン島の3か所。 • アデリーペンギン、ヒゲペンギン、ジェンツーペンギンの3種のペンギン。 • 嘴の長さ、高さ、翼の長さ、体重、性別、血液検査の結果などが含まれる。 アデリー(Adelie)
ジェンツー(Gentoo) ヒゲ(Chinstrap) Stan Shebs (CC BY-SA 3.0) Andrew Shiva(CC BY-SA 4.0) Stan Shebs (CC BY-SA 3.0)
アデリーペンギン Wikipediaより引用 • くちばしの根元から先端近くまで羽毛でおおわ れているのも特徴で、くちばしが短いように見え るが、口を開けると目の前まで開く。これは南極 の厳しい寒さに適応した結果羽毛が無い部分が 少なくなったと考えられる。
• また、他のペンギンに比べて尾羽が長いが、こ れはヒゲペンギン、ジェンツーペンギンにも共通 する特徴である。ペンギンの分類ではこの3種類 をまとめてアデリーペンギン属(Pygoscelis属)と して扱う。 • Suicaのペンギンのモデル。 Jerzy Strzelecki(CC BY 3.0)
ヒゲペンギン Wikipediaより引用 • 目の後ろから喉を通る黒い帯模様が あるのが特徴である。和名の「ヒゲペ ンギン」は喉を通る帯模様をあごひげ に見立てたものである。また、英名 の"Chinstrap"は帽子やヘルメットの あごひものことで、これもやはり喉を 通る帯模様に由来している。
引用元
ジェンツーペンギン Wikipediaより引用 • 両目をつなぐ白い帯模様が特徴であ る。 • 大きさはペンギン18種類のうち、コウ テイペンギン、キングペンギンに次い で3番目に大きい。また、オスの方がメ スよりわずかに大きい。更に、ペンギ
ンで最も泳ぐのが速いペンギンでもあ る。最高時速は時速35kmにも達す る。 Ben Tubby(CC BY 2.0)
2つのデータセット penguins_raw 生のデータ • 17変数 • studyName: 研究名(越冬隊ごと?) •
Sample Number: 標本番号(連番) • Species: ペンギンの種(学名付き) • Region: 調査した地域 • Island: 調査した島 • Stage: 発育段階 • Individual ID: 個体ID • Clutch Completion: 巣の完成度 • Date Egg: 巣に1個以上の卵が確認された日? • Culmen Length (mm): くちばしの長さ • Culmen Depth (mm): くちばしの高さ • Flipper Length (mm): 翼の長さ • Body Mass (g): 体重 • Sex: 性別 • Delta 15 N (o/oo): 窒素同位体比(δ15N) • Delta 13 C (o/oo): 炭素同位体比(δ13C) • Comments: コメント penguins 使いやすく加工されたデータ • 8変数 • species: ペンギンの種 • island: 調査した島 • bill_length_mm: くちばしの長さ • bill_depth_mm: くちばしの高さ • flipper_length_mm: 翼の長さ • body_mass_g: 体重 • sex: 性別 • year: 調査した年 Artwork by @allison_horst
とりあえず生データを確認 library(palmerpenguins) penguins_raw |> head(10) |> View()
サマリーを確認 library(summarytools) penguins_raw |> dfSummary() |> view() • 欠測値(NA)がある。 •
値がすべて同じ列がある。 • 同じ個体IDが3回出現している。
変数間の関係の概要 penguins_raw |> dplyr::select( #余分な変数を除外 !c( `Sample Number`, Region, Stage,
`Individual ID`, Comments ) ) |> GGally::ggpairs( aes(colour = Species), title = "Palmer Penguins Raw" )
変数間の関係の概要 penguins_raw |> dplyr::select( #余分な変数を除外 !c( `Sample Number`, Region, Stage,
`Individual ID`, Comments ) ) |> GGally::ggpairs( aes(colour = Species), title = "Palmer Penguins Raw" ) Date Egg x studyName と Species x Island が気になる。
研究名ごとの期間 penguins_raw |> group_by(studyName) |> summarise(Start = min(`Date Egg`), End
= max(`Date Egg`)) # studyName Start End # <chr> <date> <date> #1 PAL0708 2007-11-09 2007-12-03 #2 PAL0809 2008-11-02 2008-11-25 #3 PAL0910 2009-11-09 2009-12-01
調査した島と生息するペンギンの種 penguins_raw |> xtabs(~ Species + Island, data = _)
# Island #Species Biscoe Dream Torgersen # Adelie Penguin (Pygoscelis adeliae) 44 56 52 # Chinstrap penguin (Pygoscelis antarctica) 0 68 0 # Gentoo penguin (Pygoscelis papua) 124 0 0
「オスの方がメスよりわずかに大きい」? penguins_raw |> drop_na(Sex) |> ggplot(aes(x = Sex, y =
`Body Mass (g)`)) + geom_violin(aes(colour=Sex, fill = Sex)) + geom_boxplot(width = 0.3) + geom_jitter(width = 0.15, height = 0) + facet_wrap(vars(Species)) + labs( title = "性別と体重", x = "性別", y = "体重 (g)", colour = "性別", fill = "性別" ) + theme(text = element_text(size = 18))
to be continued... 今後の予定: 1. データセットの紹介(今回) 2. データクリーニング ◦ penguins_rawからpenguinsへ
3. 可視化例 4. 分析例 ◦ シンプソンのパラドクス ◦ 次元縮約 ◦ クラスタリング ◦ 判別モデル ◦ などなど いらすとやにはアデリーペン ギンがいなかった…… タイトルの「パーマーステーションのペ ンギンたち」は『ウォーターシップダウ ンのウサギたち』をもじったつもり。