rm_source_notes | R Documentation |
If you have one or more source notes that ought to be removed,
rm_source_notes()
allows for such a selective removal. The table footer is
an optional table part that is positioned below the table body, containing
areas for both the source notes and footnotes.
This function for removal is useful if you have received a gt table
(perhaps through an API that returns gt objects) but would prefer that
some or all of the source notes be removed. This function is safe to use even
if there are no source notes in the input gt_tbl
object so long as select
helpers (such as the default everything()
) are used instead of explicit
integer values.
rm_source_notes(data, source_notes = everything())
data |
The gt table data object
This is the gt table object that is commonly created through use of the
|
source_notes |
Source notes to remove
A specification of which source notes should be removed. The source notes
to be removed can be given as a vector of integer values (they are stored
as integer positions, in order of creation, starting at |
An object of class gt_tbl
.
Use a subset of the gtcars
dataset to create a gt table.
tab_source_note()
is used to add a source note to the table footer that
cites the data source (or, it could just be arbitrary text). We'll use the
function twice, in effect adding two source notes to the footer.
gt_tbl <- gtcars |> dplyr::select(mfr, model, msrp) |> dplyr::slice(1:5) |> gt() |> tab_source_note(source_note = "Data from the 'edmunds.com' site.") |> tab_source_note(source_note = "Showing only the first five rows.") |> cols_width(everything() ~ px(120)) gt_tbl
If you decide that you don't want the source notes in the gt_tbl
object,
they can be removed with rm_source_notes()
.
rm_source_notes(data = gt_tbl)
Individual source notes can be selectively removed. Source notes are
identified by their index values. To remove the source note concerning the
extent of the data (source note 2
, since it was supplied to gt after
the other source note) we would give the correct index value to
source_notes
.
rm_source_notes(data = gt_tbl, source_notes = 2)
7-5
v0.8.0
(November 16, 2022)
Other part removal functions:
rm_caption()
,
rm_footnotes()
,
rm_header()
,
rm_spanners()
,
rm_stubhead()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.