r4ds/workflow-pipes.Rmd

29 lines
464 B
Plaintext
Raw Normal View History

2021-04-21 21:25:39 +08:00
# Workflow: pipes {#workflow-pipes}
- Indenting and line breaks
```{r, eval = FALSE}
df %>% mutate(y = x + 1)
# vs
df %>%
mutate(
y = x + 1
)
```
- `mutate(df, y = x + 1)` vs `df %>% mutate(df, y = x + 1)`
- with ggplot2
```{r, eval = FALSE}
df %>%
ggplot(aes())
```
Don't forget to switch to plus!
- How long should your pipes be?
Too long vs too short
- Restyling with style.