Fix slice_sample() typo

Fixes #1131
This commit is contained in:
Hadley Wickham 2022-11-18 15:27:05 -06:00
parent 5d06b2c6d0
commit d06d4129e6
1 changed files with 1 additions and 1 deletions

View File

@ -471,7 +471,7 @@ There are five handy functions that allow you pick off specific rows within each
- `df |> slice_tail(n = 1)` takes the last row in each group.
- `df |> slice_min(x, n = 1)` takes the row with the smallest value of `x`.
- `df |> slice_max(x, n = 1)` takes the row with the largest value of `x`.
- `df |> slice_sample(x, n = 1)` takes one random row.
- `df |> slice_sample(n = 1)` takes one random row.
You can vary `n` to select more than one row, or instead of `n =`, you can use `prop = 0.1` to select (e.g.) 10% of the rows in each group.
For example, the following code finds the most delayed flight to each destination: