Suche senden
Hochladen
Tokyo.r 女子資料
•
Als PPTX, PDF herunterladen
•
3 gefällt mir
•
1,977 views
Maiko Fukata
Folgen
Melden
Teilen
Melden
Teilen
1 von 27
Jetzt herunterladen
Empfohlen
Rゼミ 1
Rゼミ 1
tarokun3
Rでプロット
Rでプロット
Tsukasa Fukunaga
Shiny100本ノックの進捗
Shiny100本ノックの進捗
UrNp
第19回疫学セミナー 統計解析ソフトRの活用「Rで線形モデル」
第19回疫学セミナー 統計解析ソフトRの活用「Rで線形モデル」
Masafumi Okada
ロジスティック回帰分析の入門 -予測モデル構築-
ロジスティック回帰分析の入門 -予測モデル構築-
Koichiro Gibo
Rデータ入力編
Rデータ入力編
Monta Yashi
Tokyo r38
Tokyo r38
Takashi Minoda
10分で分かるr言語入門ver2 upload用
10分で分かるr言語入門ver2 upload用
Nobuaki Oshiro
Empfohlen
Rゼミ 1
Rゼミ 1
tarokun3
Rでプロット
Rでプロット
Tsukasa Fukunaga
Shiny100本ノックの進捗
Shiny100本ノックの進捗
UrNp
第19回疫学セミナー 統計解析ソフトRの活用「Rで線形モデル」
第19回疫学セミナー 統計解析ソフトRの活用「Rで線形モデル」
Masafumi Okada
ロジスティック回帰分析の入門 -予測モデル構築-
ロジスティック回帰分析の入門 -予測モデル構築-
Koichiro Gibo
Rデータ入力編
Rデータ入力編
Monta Yashi
Tokyo r38
Tokyo r38
Takashi Minoda
10分で分かるr言語入門ver2 upload用
10分で分かるr言語入門ver2 upload用
Nobuaki Oshiro
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Weitere ähnliche Inhalte
Empfohlen
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Empfohlen
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Tokyo.r 女子資料
1.
Rの基礎いろいろ 2013.10.13 TOKYO.R JOSHIBU #2
2.
Rとわたし • はじめてRに触れたのは、大学のときの授業。 • 仕事でR使用中。主にデータ処理やグラフ作成など。 •
Rを使ってモデリングとかシュミレーションしたい。 (今後仕事で必要になるので…) • 現在、ちょっとずつ統計を勉強中。
3.
今日やること 前置きが長くなってすいません… (本当は)CodeIQ に出題されてた Rの問題をやる予定でした…。。 URL: https://codeiq.jp/ ただ、〆切が結構先なので 別の内容にしました。
4.
irisデータを 使ってプロットす る
5.
irisデータとは… • Rには100以上のデータセットが付属。 • iris
データは、3品種のあやめのがく片や花びらの長さや幅 などのデータから成り立っている。 • Fisher の研究でも使われたデータ。 • Rのデータセットについて詳しく説明されているサイト様。 http://d.hatena.ne.jp/hoxo_m/20120214/p1
6.
iris データをみる • コマンド実行するとデータが一気に表示されるはず。 •
このデータの内容、もうちょっと簡単にみたいんだけど? • そんなときは、str() を使う。 $ iris
7.
str()でデータの内容をみる $ str(iris) > str(iris) 'data.frame':
150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... データ構造 • もうちょっと詳しくみたい、そんなときはsummary() ! 行数、列数 データの特徴
8.
summary() で特徴(要約等計量)を みる $ summary(iris) >
summary(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 Median :5.800 Median :3.000 Median :4.350 Median :1.300 Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 Species setosa :50 versicolor:50 virginica :50 Min.: 最小値 1st Qu.:第一四分位数 Median: 中央値 Mean: 平均値 3rd Qu.: 第三四分位数 Max.: 最大値 これはFactor型なので 品種ごとの行数が表 示
9.
データにアクセス • 部分データを取得したい場合には、c関数を使う $ iris[1:30,
1:2] 行アクセス 列アクセス $ iris$Sepal.Length データフレーム$変数 名
10.
変数名を取得する $ colnames(iris) $ rownames(iris) 行名取得 列名取得
11.
とりあえず、plot() $ plot(iris[,1], iris[,2])
12.
X軸, Y軸のラベルを変更 $ plot(iris[,1],
iris[,2], xlab=“Sepal.Length”, ylab=“Sepal.Width”)
13.
色をつける $ plot(iris[,1], iris[,2],
xlab=“Sepal.Length”, ylab=“Sepal.Wi dth”, col=“blue”)
14.
軸の長さを指定する $ plot(iris[,1], iris[,2],
xlab=“Sepal.Length”, ylab=“Sepal.Width”, col=“blue”, xlim=c(0,8), ylim=c(0,8))
15.
プロットマーカー変更 $ plot(iris[,1], iris[,2],
xlab=“Sepal.Length”, ylab=“Sepal.Width”, col=“blue”, xlim=c(0,8), ylim=c(0,8), pch=20)
16.
プロットマーカー一覧 • pch=値 で点をプロットする文字を指定できる
17.
品種ごとにマーカーの色を変更 $ plot(iris$Sepal.Length, iris$Sepal.Width, xlab="Sepal.Length",
ylab="Sepal.Width", col=c(1:length(unique(iris$Species))), ylim=c(2,6), pch=20) 3でもいい
18.
品種ごとにマーカーの色を変更
19.
凡例を追加する $ plot(iris$Sepal.Length, iris$Sepal.Width, xlab="Sepal.Length",
ylab="Sepal.Width", col=c(1:length(unique(iris$Species))), ylim=c(2,6), pch=20) $ legend("topright", legend=unique(iris$Species), col=c(1:length(unique(iris$Species))),pch=20)
20.
凡例を追加する
21.
グラフに文字を書き込む • そのまえに、Sepal.Length とSepal.Width
の相関係数を求め る (書き込むデータを用意するため) • text() を使って求めた相関係数をグラフに書き込む $ r <- cor(iris$Sepal.Length, iris$Sepal.Width) $ r [1] -0.1175698
22.
グラフに文字を書き込む $ plot(iris$Sepal.Length, iris$Sepal.Width,
xlab="Sepal.Le ngth", ylab="Sepal.Width", col=“blue”, ylim=c(2,6), pch=2 0) $ text(7, 5, label=r, srt=0, cex=0.8)
23.
グラフに文字を書き込む
24.
plot() ではものたりない場合… • ggplot() •
パッケージをインストールする必要がある $ install.packages(ggplot2) $ library(ggplot2) • 書き方になれないとかなり使いにくい…
25.
ggplot() で描写してみるとこんな感 じ $ ggplot(iris[,1:2],
aes(Sepal.Length, Sepal.Width))+geom_point() • こんなかんじで描写 • 場合によっては、ggplot() 使ったほうが楽に描写で きるものもある (例:積み上げグラフと か)
26.
わからないときは… • R−tips http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html • RjpWiki http://www.okada.jp.org/Rwiki/ •
seekR http://seekr.jp/ • ひたすらググる、もしくは人に聞く
27.
ご清聴ありがとうございま した 至らない点が多々あったと思いますが、 最後までお付き合いしていただきありがとうございました。 今後もどうぞよろしくお願いします。 E-mail: mf.0833 <at>
gmail.com
Jetzt herunterladen