Skip to content

Commit

Permalink
lazyman
Browse files Browse the repository at this point in the history
  • Loading branch information
perlatex committed May 21, 2022
1 parent 41d0840 commit def82a2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
20 changes: 20 additions & 0 deletions baseR_functions_adv.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,24 @@ mystat <- function(x){

## 更多

冰淇淋放大器,这个机器有很多档位,可以让冰淇淋放大指定的倍数,默认为10倍

```{r}
enlarge_icecream <- function(multi = 10) {
function(penis) {
penis * multi
}
}
```

等待被放大的冰淇淋的大小
```{r}
x <- c(2, 3, 4.5)
x
```

这个冰淇淋机器 `extent_penis(multi = 100)()`有很多档位,可以指定放大的倍数,比如这里设定为100倍
```{r}
enlarge_icecream(multi = 100)(x)
```

10 changes: 7 additions & 3 deletions eda_lazyman.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,16 @@ library(statsExpressions)
# https://github.com/IndrajeetPatil/statsExpressions
ggplot(mtcars, aes(x = mpg, y = wt)) +
# dataframe with results
results_data <- corr_test(mtcars, mpg, wt, type = "nonparametric")
# create a scatter plot
ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
geom_smooth(method = "lm") +
geom_smooth(method = "lm", formula = y ~ x) +
labs(
title = "Spearman's rank correlation coefficient",
subtitle = expr_corr_test(mtcars, mpg, wt, type = "nonparametric")
subtitle = parse(text = results_data$expression)
)
```

Expand Down
13 changes: 13 additions & 0 deletions tidyverse_beauty_of_across4.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ d %>%
mutate(100 * proportions(across(.names = "%{.col}")))
```

### 方法6
更好的呈现比例

```{r beauty-of-across4-8-0}
d %>%
rowwise() %>%
mutate(
across(c(water, food), ~scales::label_percent(scale = 100)(.x /sum(c_across())), .names = "{.col}_%")
)
```



上面的方法虽然很多,但基本思路是一样的。


Expand Down

0 comments on commit def82a2

Please sign in to comment.