Rendering a post using a {renv} profile with {dplyr} version 0.8.5.
To generate this demo, I:
distill::create_post("dplyr-085")
renv::activate(profile = "2022-03-14-dplyr-085")
renv::install(
"distill",
"rmarkdown",
"palmerpenguins",
"dplyr@0.8.5"
)
renv::snapshot()
To demonstrate package dependency control, I’ve installed {dplyr} version 0.8.5 for this post, which is the version before the across()
function was introduced.
I’ve written another post that uses a newer version (1.0.8) of {dplyr} to prove that the dependencies don’t conflict.
We can prove the across()
function doesn’t exist for the version of {dplyr} installed with the ‘2022-03-14-dplyr-085’ profile.
This means we have to make do with {dplyr}’s old functionality for across()
, which amounts to the *_if()
, *_at()
and *_all()
variants of verbs like mutate()
and summarise()
.
Here’s a very small example.
palmerpenguins::penguins %>%
select_if(is.factor) %>%
mutate_at(vars(species, island), tolower) %>%
head()
# A tibble: 6 × 3
species island sex
<chr> <chr> <fct>
1 adelie torgersen male
2 adelie torgersen female
3 adelie torgersen female
4 adelie torgersen <NA>
5 adelie torgersen female
6 adelie torgersen male