統計解析R たぶんpart3くらい (587レス)
上下前次1-新
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん
リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
352: 2021/04/04(日)06:55 ID:CeSVCjFt(1/2) AAS
上の回答が答えになっていると思う。以下はおまけ。
``` {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));
}
```
続く
353(1): 2021/04/04(日)06:56 ID:CeSVCjFt(2/2) AAS
パイプ無し版
``` {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 (.);
```
省1
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.029s