Skip to content

Commit

Permalink
reorder chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
perlatex committed Aug 29, 2020
1 parent 5c05976 commit 6b5a07d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 20 deletions.
8 changes: 4 additions & 4 deletions _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ rmd_files: [
"tidyverse_tips.Rmd",
"dot.Rmd",
"tidyeval.Rmd",


#
# #work
"sampling.Rmd", # 建模篇
"tidystats.Rmd",
"lm.Rmd",
"lmm.Rmd",
"glm.Rmd",
"ordinal.Rmd",
"tidymodels.Rmd",


#
#
"eda_nobel.Rmd", # 应用篇
"eda_olympics.Rmd",
"eda_covid2019.Rmd",
Expand Down
4 changes: 3 additions & 1 deletion adv_dplyr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ glimpse(roster)
### purrr & dplyr 技巧
```{r message=FALSE, warning=FALSE}
library(purrr)
airquality <- as_tibble(airquality)
airquality %>% purrr::map(~ sum(is.na(.)))
```

Expand Down Expand Up @@ -612,7 +614,7 @@ iris %>%

### across函数替代scope函数

强大的`across()`函数,替代以上`scope`函数(_if, _at, 和 _all函数), 同时`slice_max()`, `slice_min()`, `slice_n()` 将替代 `top_n()`函数。
强大的`across()`函数,替代以上`scope`函数(_if, _at, 和 _all函数), 同时`slice_max()`, `slice_min()`, `slice_n()` 将替代 `top_n()`函数。请参考阅读第\@ref(colwise) 章。

```{r, eval = FALSE}
df %>% mutate_if(is.numeric, mean, na.rm = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion eda_caribou.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ p
```{r, echo = F}
# remove the objects
# rm(list=ls())
rm(df, example_animal, individuals, location_with_speed, locations, movement, p, top_animal_ids)
rm(example_animal, individuals, location_with_speed, locations, movement, top_animal_ids)
```

```{r, echo = F, message = F, warning = F, results = "hide"}
Expand Down
3 changes: 2 additions & 1 deletion eda_penguins.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ d %>%
head()
```

```{r}

```{r message = FALSE, warning = FALSE}
library(tidyverse)
penguins <- read_csv("./demo_data/penguins.csv") %>%
janitor::clean_names()
Expand Down
3 changes: 2 additions & 1 deletion ggplot2_theme.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ glimpse(mpg)

稍微做点数据整理
```{r}
df <- mpg %>%
df <- mpg %>%
as_tibble() %>%
filter(class != "2seater", manufacturer %in% c("toyota", "volkswagen"))
df
```
Expand Down
5 changes: 3 additions & 2 deletions glm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $$


把这**四个前提**画在一张图中
```{r}
```{r out.width = '80%', fig.align='center', echo = FALSE}
knitr::include_graphics(path = "images/LINE.png")
```

Expand All @@ -50,7 +50,7 @@ knitr::include_graphics(path = "images/LINE.png")

> 在受污染的岛屿附近,金枪鱼出现次数
```{r}
```{r out.width = '50%', fig.align='center', echo = FALSE}
knitr::include_graphics(path = "images/fishes.png")
```

Expand Down Expand Up @@ -104,6 +104,7 @@ df %>%
title = "number of fishes (Poisson distribution)"
)
```

这是典型的泊松分布。

```{r}
Expand Down
4 changes: 2 additions & 2 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ knitr::include_graphics("images/rbook1.png")

```{r, eval = FALSE}
my_packages <- c(
"brms", "broom", "broom.mixed", "corrr", "countrycode", "cowplot", "cranlogs", "datapasta", "devtools", "dplyr", "forcats", "gapminder", "gganimate", "ggstatsplot", "ggeffects", "ggbeeswarm", "ggforce", "gghighlight", "ggplot2", "ggpubr", "ggraph", "ggrepel", "ggridges", "ggtext", "gt", "gtsummary", "haven", "here", "janitor", "knitr", "latex2exp", "lme4", "lubridate", "maps", "margins", "MASS", "modelr", "naniar", "nycflights13", "ordinal", "pacman", "paletteer", "patchwork", "performance", "purrr", "readr", "readxl", "remotes", "reprex", "rlang", "rmarkdown", "rstan", "rvest", "scales", "sf", "shadowtext", "showtext", "slider", "stars", "statsExpressions", "stringr", "styler", "tibble", "tibbletime", "tidybayes", "tidygraph", "tidymodels", "tidyr", "tidytext", "tidyverse", "tinytex", "viridis", "visdat", "geoshpere", "ggstatsplot", "datasauRus", "ggimage", "ggthemes", "pacman"
"brms", "broom", "broom.mixed", "corrr", "countrycode", "cowplot", "cranlogs", "datapasta", "devtools", "dplyr", "forcats", "gapminder", "gganimate", "ggstatsplot", "ggeffects", "ggbeeswarm", "ggforce", "gghighlight", "ggplot2", "ggpubr", "ggraph", "ggrepel", "ggridges", "ggtext", "gt", "gtsummary", "haven", "here", "janitor", "knitr", "latex2exp", "lme4", "lubridate", "maps", "margins", "MASS", "modelr", "naniar", "nycflights13", "ordinal", "pacman", "paletteer", "patchwork", "performance", "purrr", "readr", "readxl", "remotes", "reprex", "rlang", "rmarkdown", "rstan", "rvest", "scales", "sf", "shadowtext", "showtext", "slider", "stars", "statsExpressions", "stringr", "styler", "tibble", "tibbletime", "tidybayes", "tidygraph", "tidymodels", "tidyr", "tidytext", "tidyverse", "tinytex", "viridis", "visdat", "geoshpere", "ggstatsplot", "datasauRus", "ggimage", "ggthemes", "pacman", "equatiomatic"
)
```

Expand All @@ -173,7 +173,7 @@ install.packages(my_packages, repos = "http://cran.rstudio.com", dependencies =
可能用到的开发版本的宏包

```{r, eval = FALSE}
remotes::install_github("datalorax/equatiomatic")
#remotes::install_github("datalorax/equatiomatic")
devtools::install_github("easystats/report")
devtools::install_github("kassambara/navdata")
devtools::install_github('cttobin/ggthemr')
Expand Down
2 changes: 1 addition & 1 deletion lazyman.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
R社区上很多大神,贡献了很多非常优秀的工具,节省了我们的时间,也给我们的生活增添了无限乐趣。我平时逛github的时候时整理一些,现在分享出来供像我一样的懒人用,因此本文档叫“懒人系列”。欢迎大家补充。

## 列名太乱了
```{r}
```{r message = FALSE, warning = FALSE}
library(tidyverse)
library(janitor)
## install.packages("janitor")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ account: wangminjie
server: bookdown.org
hostUrl: https://bookdown.org/__api__
appId: 3039
bundleId: 25015
bundleId: 27162
url: https://bookdown.org/wangminjie/R4DS/
when: 1594628383.43817
when: 1598681503.77481
3 changes: 2 additions & 1 deletion rvest.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ df_price <-
mutate_at(vars(name), ~str_remove_all(., " ") ) %>%
mutate_at(vars(name), ~if_else( name == "黑龙江", "黑龙江省", .))
df_price
df_price %>%
head()
```


Expand Down
9 changes: 5 additions & 4 deletions tidygraph.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ mtcars data set: R 的内置数据集,记录了32种不同品牌的轿车的

```{r}
library(corrr)
res.cor <- mtcars[, c(1, 3:6)] %>% # (1)
res.cor <- datasets::mtcars[, c(1, 3:6)] %>% # (1)
t() %>%
correlate() %>% # (2)
shave(upper = TRUE) %>% # (3)
Expand Down Expand Up @@ -222,16 +222,17 @@ Note that, to extract the current active data as a tibble, you can use the funct

```{r}
# Car groups info
cars.group <- data_frame(
name = rownames(mtcars),
cyl = as.factor(mtcars$cyl)
cars.group <- tibble(
name = rownames(datasets::mtcars),
cyl = as.factor(datasets::mtcars$cyl)
)
cars.group
```





### Modify the nodes data:

```{r}
Expand Down

0 comments on commit 6b5a07d

Please sign in to comment.