Skip to content

Commit

Permalink
correct pak installation instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
luisDVA committed Aug 26, 2024
1 parent 21093d0 commit 8d14c20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ install.packages("tidyverse")
install.packages("magrittr")
# Or the development version from GitHub:
# install.packages("devtools")
# install.packages("pak")
pak::pak("tidyverse/magrittr")
```

Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ coverage](https://codecov.io/gh/tidyverse/magrittr/branch/main/graph/badge.svg)]
The magrittr package offers a set of operators which make your code more
readable by:

- structuring sequences of data operations left-to-right (as opposed
to from the inside and out),
- avoiding nested function calls,
- minimizing the need for local variables and function definitions,
and
- making it easy to add steps anywhere in the sequence of operations.
- structuring sequences of data operations left-to-right (as opposed to
from the inside and out),
- avoiding nested function calls,
- minimizing the need for local variables and function definitions, and
- making it easy to add steps anywhere in the sequence of operations.

The operators pipe their left-hand side values forward into expressions
that appear on the right-hand side, i.e. one can replace `f(x)` with
Expand Down Expand Up @@ -57,17 +56,17 @@ install.packages("tidyverse")
install.packages("magrittr")

# Or the development version from GitHub:
# install.packages("devtools")
# install.packages("pak")
pak::pak("tidyverse/magrittr")
```

## Usage

### Basic piping

- `x %>% f` is equivalent to `f(x)`
- `x %>% f(y)` is equivalent to `f(x, y)`
- `x %>% f %>% g %>% h` is equivalent to `h(g(f(x)))`
- `x %>% f` is equivalent to `f(x)`
- `x %>% f(y)` is equivalent to `f(x, y)`
- `x %>% f %>% g %>% h` is equivalent to `h(g(f(x)))`

Here, “equivalent” is not technically exact: evaluation is non-standard,
and the left-hand side is evaluated before passed on to the right-hand
Expand All @@ -76,8 +75,8 @@ implication.

### The argument placeholder

- `x %>% f(y, .)` is equivalent to `f(y, x)`
- `x %>% f(y, z = .)` is equivalent to `f(y, z = x)`
- `x %>% f(y, .)` is equivalent to `f(y, x)`
- `x %>% f(y, z = .)` is equivalent to `f(y, z = x)`

### Re-using the placeholder for attributes

Expand Down Expand Up @@ -120,6 +119,9 @@ iris %>%
subset(Sepal.Length > mean(Sepal.Length)) %$%
cor(Sepal.Length, Sepal.Width)
#> [1] 0.3361992
```

``` r

data.frame(z = rnorm(100)) %$%
ts.plot(z)
Expand Down

0 comments on commit 8d14c20

Please sign in to comment.