Skip to content

Commit e645ec8

Browse files
committed
Added a space after the slice_sample() example chunk to fix running subsequent chunks. Clarified wording for slice_max() and slice_min() in the intro vignette
1 parent 71b2961 commit e645ec8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vignettes/dplyr.Rmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,15 @@ starwars |> slice_head(n = 3)
124124
starwars |> slice_sample(n = 5)
125125
starwars |> slice_sample(prop = 0.1)
126126
```
127+
127128
Use `replace = TRUE` to perform a bootstrap sample. If needed, you can weight the sample with the `weight` argument.
128129

129-
* `slice_min()` and `slice_max()` select rows with highest or lowest values of a variable. Note that we first must choose only the values which are not NA.
130+
* `slice_max()` and `slice_min()` selects the rows with the largest or smallest values of the selected column, by default it returns the single maximum or minimum, but you can supply `n` to control how many rows remain. Rows with NA in the ordering column are dropped.
130131

131132
```{r}
132133
starwars |>
133134
filter(!is.na(height)) |>
134-
slice_max(height, n = 3)
135+
slice_max(height)
135136
```
136137

137138
### Select columns with `select()`

0 commit comments

Comments
 (0)