統計解析R たぶんpart3くらい (587レス)
統計解析R たぶんpart3くらい http://mevius.5ch.net/test/read.cgi/tech/1340339592/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
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
393: デフォルトの名無しさん [] 2021/06/20(日) 18:54:38.51 ID:dkTIMvj9 前説が長いので最初に結論: >353は真似しないで欲しい。 [IHaskell](https://github.com/gibiansky/IHaskell)でコードを書く。 ``` 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]) ``` [関手](https://en.wikipedia.org/wiki/Functor)と呼ばれるデザインパターンを 使っている。このパターンを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 ()); }); ``` つづく http://mevius.5ch.net/test/read.cgi/tech/1340339592/393
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.214s*