I keep getting this error, when working on an example gt table with Palmer penguins
Error in resolver_stop_on_character()
:
! The following row(s) do not exist in the data: Gentoo.
Run rlang::last_error()
to see where the error occurred.
I run into the problem on the last line of code for the tab_footnote(). Everything else works fine before it. This is from an example on YouTube - Rich Iannone || Making Beautiful Tables with {gt} || RStudio - YouTube
Here's my code :
penguins %>%
group_by(species) %>%
summarize_at(
.vars = c(
"bill_length_mm",
"bill_depth_mm",
"flipper_length_mm",
"body_mass_g"),
.funs = ~ mean(., na.rm = TRUE)) %>%
gt(rowname_col = "species") %>%
tab_header(
title = md("Summary of the `penguins` dataset"),
subtitle = md("**Three** years of data on penguins on *three* islands")
) %>%
cols_label(
bill_length_mm = md("Bill Length,<br>mm"),
bill_depth_mm = md("Bill Depth,<br>mm"),
flipper_length_mm = md("Flipper Length, <br>mm"),
body_mass_g = md("Body Mass, <br>kg")
) %>%
opt_align_table_header(align = "left") %>%
fmt_number(columns = everything()) %>%
fmt_number(columns = body_mass_g, scale_by = 1/1000) %>%
cols_width(
bill_length_mm ~ px(120),
bill_depth_mm ~ px(120),
flipper_length_mm ~ px(120),
body_mass_g ~ px(120),
everything() ~ px(100)) %>%
tab_source_note(source_note = md("Data provided
by the *Palmer Penguins* Data Package")) %>%
tab_footnote(
footnote = "The largest penguin ever",
locations = cells_stub(rows = "Gentoo"))