Skip to content

Commit

Permalink
add chunk label
Browse files Browse the repository at this point in the history
  • Loading branch information
perlatex committed Dec 24, 2020
1 parent 9db9d32 commit ea3ddbe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
5 changes: 1 addition & 4 deletions _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rmd_files: [
"intro_R.Rmd",
"subsetting.Rmd",


# tidyverse篇
"rmarkdown.Rmd",
"readr.Rmd",
Expand All @@ -39,12 +38,11 @@ rmd_files: [
"tidyverse_tips.Rmd",
"adv_dplyr.Rmd",
"colwise.Rmd",
"beatuty_of_across.Rmd",
"beauty_of_across.Rmd",
"tidyverse_NA.Rmd",
"dot.Rmd",
"tidyeval.Rmd",


# 建模篇
"sampling.Rmd",
"lm.Rmd",
Expand All @@ -58,7 +56,6 @@ rmd_files: [
"ordinal.Rmd",
"tidymodels.Rmd",


# 应用篇
"eda_nobel.Rmd",
"eda_olympics.Rmd",
Expand Down
2 changes: 1 addition & 1 deletion beatuty_of_across.Rmd → beauty_of_across.Rmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tidyverse中的across()之美 {#beatuty-of-across}
# tidyverse中的across()之美 {#beauty-of-across}


dplyr 1.0版本增加了`across()`函数,这个函数集中体现了dplyr宏包的强大和简约,今天我用企鹅数据,来领略它的美。
Expand Down
2 changes: 1 addition & 1 deletion index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ knitr::include_graphics("images/rbook1.png")
-\@ref(tips) 章介绍tidyverse常用技巧
-\@ref(advR) 章介绍tidyverse进阶技巧
-\@ref(colwise) 章介绍数据框的列方向和行方向
-\@ref(beatuty-of-across) 章介绍tidyverse中的across()之美
-\@ref(beauty-of-across) 章介绍tidyverse中的across()之美
-\@ref(tidyverse-NA) 章介绍tidyverse中的NA
-\@ref(dot) 章介绍tidyverse中的dot
-\@ref(tidyeval) 章介绍非标准性评估
Expand Down
25 changes: 11 additions & 14 deletions lazyman.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
R社区上很多大神,贡献了很多非常优秀的工具,节省了我们的时间,也给我们的生活增添了无限乐趣。我平时逛github的时候时整理一些,现在分享出来供像我一样的懒人用,因此本文档叫“懒人系列”。欢迎大家补充。

## 列名太乱了
```{r message = FALSE, warning = FALSE}
```{r lazyman01, message = FALSE, warning = FALSE}
library(tidyverse)
library(janitor)
## install.packages("janitor")
Expand All @@ -30,7 +30,7 @@ fake_raw %>% janitor::clean_names()
## 比count()更懂我的心
```{r}
mtcars %>%
count(cyl)
dplyr::count(cyl)
```

```{r}
Expand Down Expand Up @@ -110,14 +110,14 @@ library(report)
```


```{r, results="asis"}
```{r lazyman-report, results="asis"}
model <- lm(Sepal.Length ~ Species, data = iris)
report(model)
```


## 模型评估一步到位
```{r}
```{r lazyman-performance, eval=FALSE}
library(performance)
model <- lm(mpg ~ wt * cyl + gear, data = mtcars)
Expand All @@ -127,7 +127,7 @@ performance::check_model(model)


## 统计表格不用愁
```{r, results="asis", eval=FALSE, include=TRUE}
```{r lazyman-gtsummary1, results="asis", eval=FALSE, include=TRUE}
library(gtsummary)
## https://github.com/ddsjoberg/gtsummary
Expand All @@ -146,7 +146,7 @@ gtsummary::trial %>%


直接复制到论文即可
```{r, results="asis", eval=FALSE, include=TRUE}
```{r lazyman-gtsummary2, results="asis", eval=FALSE, include=TRUE}
t1 <-
glm(response ~ trt + age + grade, trial, family = binomial) %>%
gtsummary::tbl_regression(exponentiate = TRUE)
Expand All @@ -167,7 +167,7 @@ gtsummary::tbl_merge(

## 统计结果写图上

```{r, out.width='99%'}
```{r lazyman-statsExpressions, out.width='99%', eval=FALSE, include=TRUE}
library(ggplot2)
library(statsExpressions)
# https://github.com/IndrajeetPatil/statsExpressions
Expand Down Expand Up @@ -250,7 +250,7 @@ library(pacman)


## 犹抱琵琶半遮面
```{r}
```{r lazyman-gganonymize}
## https://github.com/EmilHvitfeldt/gganonymize
library(ggplot2)
library(gganonymize)
Expand Down Expand Up @@ -297,7 +297,7 @@ gganonomize(ggg)
你听到了声音吗?

## 多张图摆放
```{r}
```{r lazyman-patchwork, eval=FALSE}
library(patchwork)
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
Expand All @@ -309,7 +309,7 @@ p1 + p2 + p3
```

## 缺失值处理
```{r}
```{r lazyman-naniar}
library(naniar)
## https://github.com/njtierney/naniar
Expand Down Expand Up @@ -350,10 +350,7 @@ vis_dat(airquality)
```{r, echo = F}
# remove the objects
# rm(list=ls())
rm(df, fake_raw, ggg, mod1, model, p1, p2, p3, s,
scale_color_continuous,
scale_color_discrete,
scale_color_gradient)
rm(df, fake_raw, ggg, mod1, model, p1, p2, p3, s, scale_color_continuous, scale_color_discrete, scale_color_gradient)
```

```{r, echo = F, message = F, warning = F, results = "hide"}
Expand Down

0 comments on commit ea3ddbe

Please sign in to comment.