00.初めての医療統計rとezr:16.ggplot2で棒グラフ
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
00.初めての医療統計rとezr:16.ggplot2で棒グラフ [2020/08/08] – [dplyr(tidyverseに含まれる)で表を編集してグラフを描いたり検定したりする] adash333 | 00.初めての医療統計rとezr:16.ggplot2で棒グラフ [2020/08/12] – [dplyr(tidyverseに含まれる)で表を編集してグラフを描いたり検定したりする] adash333 | ||
---|---|---|---|
行 27: | 行 27: | ||
< | < | ||
- | ggplot() + | + | library(tidyverse) |
- | scale_x_discrete() | + | |
+ | d <- iris %>% | ||
+ | select(Sepal.Length, | ||
+ | group_by(Species) %>% | ||
+ | summarise(n = n(), mean = mean(Sepal.Length), | ||
+ | d | ||
+ | |||
+ | |||
+ | ggplot(d, aes(x=Species, | ||
+ | | ||
+ | |||
+ | # 3群のうち、2群のみのグラフを表示するときは | ||
+ | # scale_x_discrete(limits=c(" | ||
+ | # x軸はfactorにしておく、順番も指定できる | ||
+ | ggplot(d, aes(x=Species, | ||
+ | geom_bar(stat=" | ||
+ | scale_x_discrete(limits=c(" | ||
| | ||
</ | </ |
00.初めての医療統計rとezr/16.ggplot2で棒グラフ.txt · 最終更新: 2021/08/08 by adash333