統計解析R たぶんpart3くらい (587レス)
統計解析R たぶんpart3くらい http://mevius.5ch.net/test/read.cgi/tech/1340339592/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
リロード規制
です。10分ほどで解除するので、
他のブラウザ
へ避難してください。
352: デフォルトの名無しさん [] 2021/04/04(日) 06:55:51.01 ID:CeSVCjFt 上の回答が答えになっていると思う。以下はおまけ。 ``` {r nasdaq} df = " CEO, COO, CTO, cluster 0.8, 0.4, 0.2, A 0.3, 0.5, 0.1, B 0.2, 0.3, 03, C 0.1, 0.3, 03, C 0.1, 0.2, 0.8, B "; df = read.csv (text = df, colClasses = c ("numeric", "numeric", "numeric", "character"), strip.white = T); print (df); ``` tidy無し版 ``` {r plain, dependson = 'nasdaq'} for (clazz in unique (df $ cluster)) { go = subset (df, cluster == clazz, select = - cluster); print (go); boxplot (go, xlab = 'role', ylab = 'skill', main = sprintf ('cluster = %s', clazz)); } ``` 続く http://mevius.5ch.net/test/read.cgi/tech/1340339592/352
353: デフォルトの名無しさん [] 2021/04/04(日) 06:56:59.64 ID:CeSVCjFt パイプ無し版 ``` {r tidy, dependson = 'nasdaq'} for_plot = tidyr::pivot_longer (df, - cluster, names_to = "role", values_to = "skill"); print (for_plot); for (clazz in unique (for_plot $ cluster)) { go = dplyr::filter (for_plot, cluster == clazz); print (go); . = ggplot2::ggplot (go); . = . + ggplot2::aes (x = role, y = skill); . = . + ggplot2::geom_boxplot (); . = . + ggplot2::labs ( title = sprintf ('cluster = %s', clazz) ); print (.); } ``` プロットを並べる。 ``` {r arrange_plot, dependson = 'tidy', fig.width = 4 * 2, fig.height = 4} . = ggplot2::ggplot (for_plot); . = . + ggplot2::aes (x = role, y = skill); . = . + ggplot2::geom_boxplot (); . = . + ggplot2::facet_wrap (~ cluster); print (.); ``` 箱を並べる。 ``` {r arrange_box, dependson = 'tidy', fig.width = 4 * 2, fig.height = 4} . = ggplot2::ggplot (for_plot); . = . + ggplot2::aes (x = role, y = skill, fill = cluster); . = . + ggplot2::geom_boxplot (); print (.); ``` おしまい http://mevius.5ch.net/test/read.cgi/tech/1340339592/353
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.015s