統計解析R たぶんpart3くらい (587レス)
上下前次1-新
抽出解除 レス栞
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
393: 2021/06/20(日)18:54 ID:dkTIMvj9(1/4) AAS
前説が長いので最初に結論:
>353は真似しないで欲しい。
[IHaskell](外部リンク:github.comでコードを書く。
``` haskell
import GHC.Exts (groupWith)
分割 = groupWith length
仕事 (a : as) = (length a, length as + 1)
集計 = foldl push mempty where push out a = out ++ pure a
個々 = map
物件 = words "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
比較 前処理 後処理 = lhs == rhs where
lhs = 後処理 $ 集計 . 個々 仕事 . 分割 <$> 前処理 物件
rhs = 後処理 $ 集計 <$> 個々 仕事 <$> 分割 <$> 前処理 物件
--
比較 Identity runIdentity
比較 (\a -> [a, a ++ a]) (flip (>>=) id)
比較 (\a j -> [a !! k | k <- j]) (flip id [1, 3, 5])
```
[関手](外部リンク:en.wikipedia.orgと呼ばれるデザインパターンを
使っている。このパターンをRに翻訳する。
``` {r self, dependson = ""}
self = with (new.env (), { id = \(a) a;
hom_snd = \(bc) \(ab) \(a) bc (ab (a)); flip = \(abc) \(b) \(a) abc (a) (b);
const = \(a) \(b) a; r_curry_fw = \(abc) \(a) \(b) abc (a, b);
r_curry_bw = \(abc) \(a, b) abc (a) (b); `%.%` = r_curry_bw (hom_snd);
as.list (rlang::current_env ());
});
```
つづく
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 2.111s*