To add a summary table of package
& function usage to the foot of a Quarto document, add
used_here()
to the end of the code. A separate code chunk
with an appropriate heading is suggested but not essential.
The package author recommends using the conflicted package to resolve
conflicts. In the example below, ‘dplyr’ has been preferred over stats
for filter()
and over the xts package for
last()
.
An alternative approach to using conflicted is to use the
exclude
or include.only
argument in
library()
. This is also shown below with the xts version of
first
excluded and hence the dplyr version preferred.
options(tidyverse.quiet = TRUE)
options(xts.warn_dplyr_breaks_lag = FALSE)
library(conflicted)
library(dplyr)
library(tibble)
conflicts_prefer(dplyr::filter, dplyr::last)
#> [conflicted] Will prefer dplyr::filter over any other package.
#> [conflicted] Will prefer dplyr::last over any other package.
library(usedthese)
library(xts, exclude = "first")
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#>
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
conflict_scout()
#> 3 conflicts
#> • `filter()`: dplyr
#> • `lag()`: dplyr and stats
#> • `last()`: dplyr
In the example below, tribble()
is counted once against
the (originating) tibble package even though it is also loaded by dplyr.
And had we not used the conflicted package, filter()
for
example would have shown against the package name “dplyr, stats”.
The rendered table is assigned the CSS class .usedthese
to help other used_*
functions find and aggregate multiple
tables across one or more websites.
Package | Function |
---|---|
base | library[5], options[2] |
conflicted | conflict_scout[1], conflicts_prefer[1] |
dplyr | filter[1], first[1], last[1], mutate[1], select[1] |
tibble | tribble[1] |
tidyselect | starts_with[1] |