Skip to content

Commit

Permalink
boostrap_summary() -> bootstrap_summary() (#1698)
Browse files Browse the repository at this point in the history
Fixed typo in function name of one example
  • Loading branch information
schoonees committed Mar 19, 2023
1 parent a381b07 commit cf2f6d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Functionals.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ In the diagrams, I've omitted argument names to focus on the overall structure.
This is the reason why the arguments to `map()` are a little odd: instead of being `x` and `f`, they are `.x` and `.f`. It's easiest to see the problem that leads to these names using `simple_map()` defined above. `simple_map()` has arguments `x` and `f` so you'll have problems whenever the function you are calling has arguments `x` or `f`:

```{r, error = TRUE}
boostrap_summary <- function(x, f) {
bootstrap_summary <- function(x, f) {
f(sample(x, replace = TRUE))
}
simple_map(mtcars, boostrap_summary, f = mean)
simple_map(mtcars, bootstrap_summary, f = mean)
```

<!-- GVW: a diagram here showing how the various f's and x's are matched to one another in the example above would be very helpful -->
Expand Down

0 comments on commit cf2f6d7

Please sign in to comment.