1 Star 1 Fork 1

LuWinter/R-for-Data-Science

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Chapter 1.R 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
LuWinter 提交于 2020-07-27 01:17 . Add packages
library(tidyverse)
ggplot(data = mpg) +
geom_point(mapping = aes(x = displ,y = hwy,colour = class)) +
facet_wrap(~class,ncol = 2)
ggplot(data = mpg) +
geom_smooth(mapping = aes(x = displ,y = hwy,linetype = drv)) +
geom_point(mapping = aes(x = displ,y = hwy,colour = class))
ggplot(data = mpg) +
geom_smooth(mapping = aes(x = displ,y = hwy,color = drv),show.legend = FALSE)
ggplot(data = mpg) +
geom_smooth(mapping = aes(x = displ,y = hwy))+
geom_point(mapping = aes(x = displ,y = hwy))
ggplot(data = mpg,mapping = aes(x = displ,y = hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth(data = filter(mpg, class == "subcompact"),se = FALSE)
ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy,color = drv)) +
geom_smooth(mapping = aes(x = displ, y = hwy,group = drv,linetype = drv),se = FALSE)
ggplot(data = diamonds) +
stat_count(mapping = aes(x = cut))
demo <- tribble(
~a, ~b,
"bar_1",20,
"bar_2",30,
"bar_3",40
)
ggplot(data = diamonds) +
geom_bar(mapping = aes(x = cut, color = clarity))
ggplot(data = diamonds) +
stat_summary(mapping = aes(x = cut, y = depth),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
ggplot(data = demo) +
geom_col(mapping = aes(x = a, y = b),stat = "identity")
ggplot(data = diamonds, mapping = aes(x= cut, fill = clarity)) +
geom_bar(position = "stack")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
R
1
https://gitee.com/luwinter/R-for-Data-Science.git
git@gitee.com:luwinter/R-for-Data-Science.git
luwinter
R-for-Data-Science
R-for-Data-Science
master

搜索帮助