Skip to content

Commit

Permalink
docs: elaborate on map() vs across()
Browse files Browse the repository at this point in the history
  • Loading branch information
signekb authored and lwjohnst86 committed May 6, 2024
1 parent cad9188 commit 505953f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sessions/functionals.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,11 @@ saliva_df |>

But instead, there is the `across()` function that works like `map()`
and allows you to calculate the mean across which ever columns you want.
In many ways, `across()` is a duplicate of `map()`, particularly in the
arguments you give it.
In many ways, `across()` is similar to `map()`, particularly in the
arguments you give it and in the sense that it a functional. But they
are used in different settings: `across()` works well with columns
within a dataframe and within a `mutate()` or `summarise()`, while
`map()` is more generic.

::: callout-note
## Reading task: \~2 minutes
Expand Down Expand Up @@ -968,3 +971,4 @@ changes to the Git history with {{< var keybind.git >}}.
rm(actigraph_df, rr_df)
save.image(here::here("_temp/functionals.RData"))
```

0 comments on commit 505953f

Please sign in to comment.