cells_body()
Let’s use a subset of the gtcars dataset to create a gt table. Add a footnote (with tab_footnote()) that targets a single data cell via the use of cells_body() in locations (rows = hp == max(hp) will target a single row in the hp column).
gtcars
tab_footnote()
locations
rows = hp == max(hp)
hp
gtcars |> dplyr::filter(ctry_origin == "United Kingdom") |> dplyr::select(mfr, model, year, hp) |> gt() |> tab_footnote( footnote = "Highest horsepower.", locations = cells_body( columns = hp, rows = hp == max(hp) ), placement = "right" ) |> opt_footnote_marks(marks = c("*", "+"))