29 lines
464 B
Plaintext
29 lines
464 B
Plaintext
|
# 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.
|