knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
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) library(usedthese) library(xts, exclude = "first") conflict_scout()
tribble(~group, ~a1, ~a2, ~b1, "x", 1, 2, 3, "x", 4, 5, 6, "y", 7, 8, 9) |> select(-starts_with("b")) |> filter(group == "x") |> mutate(first_a1 = first(a1), last_a2 = last(a2))
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.
used_here()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.