gt really does love HTML, and for now, gt is HTML-first which is great since HTML can do SOO many things in R Markdown, shiny, and elsewhere.
A gt table can always be saved as an .png or .pdf file if you need to incorporate it in non-HTML content. Lastly, gt does have preliminary support for RTF, and could export to a PDF via gtsave().
gt allows for HTML to be incorporated in MANY different locations with gt::html(). For example, we can use a <span style> to color the title for this table, and another <span style> to change the font size and weight for one off column. This really just scratches the surface of what is possible, and mostly you are free to use a lot of your creativity in building these tables.
As a note - it’s worth learning a bit more about how HTML works, as it will help with building R Markdown content, shiny, your personal website, and the syntax is used in the ggtext package, so it’ll help with ggplot2 as well! For a lot of this we’re nesting HTML, things should really just work, BUT if you run into problems getting some HTML content to export into content, you can try a R Markdown chunk with results='asis', along with gt() %>% as_raw_html(inline_css = TRUE).
Also, if you want to learn a bit more CSS/HTML to adjust tables beyond what I’ve shown below - check out either Mozilla Docs or the W3schools.
ex_tab<-nfl_qbr%>%select(rank, name_last, team, qbr_total, qb_plays, pass, run)%>%gt()%>%tab_header(
title =gt::html("<span style='color:red'>ESPN's QBR for 2020</span>"))%>%cols_label(
qbr_total =gt::html("<span style ='font-weight:bold;font-size:20px'>QBR</span>"))ex_tab
ESPN's QBR for 2020
rank
name_last
team
QBR
qb_plays
pass
run
1
Rodgers
Packers
79.8
608
98.4
9.3
2
Mahomes
Chiefs
78.1
710
116.1
19.1
3
Allen
Bills
76.6
729
112.1
13.0
4
Tannehill
Titans
72.6
594
68.2
22.1
5
Fitzpatrick
Dolphins
70.9
324
41.6
5.6
6
Brees
Saints
68.3
428
62.5
1.0
7
Jackson
Ravens
67.3
585
50.9
30.8
8
Wilson
Seahawks
67.1
716
88.6
9.1
9
Brady
Buccaneers
66.0
681
90.4
-3.1
10
Mayfield
Browns
65.5
597
76.9
3.3
More HTML!
So that’s cool to see where things can be changed, but let’s walk through a bit more engaging example. Here we’re going to merge some columns for the Player’s last name + team.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
rank
name_last
qbr_total
qb_plays
pass
run
1
Rodgers Packers
79.8
608
98.4
9.3
2
Mahomes Chiefs
78.1
710
116.1
19.1
3
Allen Bills
76.6
729
112.1
13.0
4
Tannehill Titans
72.6
594
68.2
22.1
5
Fitzpatrick Dolphins
70.9
324
41.6
5.6
6
Brees Saints
68.3
428
62.5
1.0
7
Jackson Ravens
67.3
585
50.9
30.8
8
Wilson Seahawks
67.1
716
88.6
9.1
9
Brady Buccaneers
66.0
681
90.4
-3.1
10
Mayfield Browns
65.5
597
76.9
3.3
This saves us some space since we’re dropping a column, but isn’t the prettiest thing. Let’s use an anonymous function and text_transform to change the styling of our player’s name/team with <span style> along with small caps, different font colors and sizes.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
rank
name_last
qbr_total
qb_plays
pass
run
1
Rodgers
Packers
79.8
608
98.4
9.3
2
Mahomes
Chiefs
78.1
710
116.1
19.1
3
Allen
Bills
76.6
729
112.1
13.0
4
Tannehill
Titans
72.6
594
68.2
22.1
5
Fitzpatrick
Dolphins
70.9
324
41.6
5.6
6
Brees
Saints
68.3
428
62.5
1.0
7
Jackson
Ravens
67.3
585
50.9
30.8
8
Wilson
Seahawks
67.1
716
88.6
9.1
9
Brady
Buccaneers
66.0
681
90.4
-3.1
10
Mayfield
Browns
65.5
597
76.9
3.3
This is starting to look better! However, since we stacked it, the rows are very tall, a bit too tall in my opinion. We can use line-height inside the <div> now to decrease the vertical space between our words.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
rank
name_last
qbr_total
qb_plays
pass
run
1
Rodgers
Packers
79.8
608
98.4
9.3
2
Mahomes
Chiefs
78.1
710
116.1
19.1
3
Allen
Bills
76.6
729
112.1
13.0
4
Tannehill
Titans
72.6
594
68.2
22.1
5
Fitzpatrick
Dolphins
70.9
324
41.6
5.6
6
Brees
Saints
68.3
428
62.5
1.0
7
Jackson
Ravens
67.3
585
50.9
30.8
8
Wilson
Seahawks
67.1
716
88.6
9.1
9
Brady
Buccaneers
66.0
681
90.4
-3.1
10
Mayfield
Browns
65.5
597
76.9
3.3
While we did that ALL within gt, we could also have made similar changes by writing some HTML with functions inside mutate ahead of sending it to gt!
# function to incorporate player name + teamcombine_word<-function(name, team){glue::glue("<div style='line-height:10px'><span style='font-weight:bold;font-variant:small-caps;font-size:14px'>{name}</div>
<div style='line-height:12px'><span style ='font-weight:bold;color:grey;font-size:10px'>{team}</span></div>")}nfl_qbr%>%select(rank, name_short, team, qbr_total, qb_plays, pass, run)%>%mutate(
combo =combine_word(name_short, team),
combo =map(combo, gt::html))%>%select(rank, combo, everything(), -name_short, -team)%>%gt()%>%cols_align(
align ="left",
columns =vars(combo))%>%tab_options(
data_row.padding =px(5))
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
rank
combo
qbr_total
qb_plays
pass
run
1
A. Rodgers
Packers
79.8
608
98.4
9.3
2
P. Mahomes
Chiefs
78.1
710
116.1
19.1
3
J. Allen
Bills
76.6
729
112.1
13.0
4
R. Tannehill
Titans
72.6
594
68.2
22.1
5
R. Fitzpatrick
Dolphins
70.9
324
41.6
5.6
6
D. Brees
Saints
68.3
428
62.5
1.0
7
L. Jackson
Ravens
67.3
585
50.9
30.8
8
R. Wilson
Seahawks
67.1
716
88.6
9.1
9
T. Brady
Buccaneers
66.0
681
90.4
-3.1
10
B. Mayfield
Browns
65.5
597
76.9
3.3
So that’s really cool and allows you to do some creative things with HTML-based content. What else can we do with HTML?
kableExtra integration
The fantastic kableExtra package has some sparkline-esque graphing capabilities that export as SVG, meaning they can be integrated into HTML.
Note that while I love gt, kableExtra is again a great package in it’s own right and has more mature LaTeX integration today. If you REALLY have to use PDF/LaTex, it’s a great choice today.
kableExtra approaches inline plots with the spec_plot() family of functions.
kableExtra example
Here’s a quick example from kableExtra, which can be adapted to work in gt, mainly incorporating an inline boxplot into the table.
We can adapt a similar idea for gt, here we are using mutate calls ahead of time to prep the data. Here we are going to keep all the data in a pipe, rather than having to split it and reference a dataset external to our table. We can essentially nest the same mpg column by group, keeping it in a single tibble this time. As an aside, note that you can embed ANY ggplot into gt with gt::ggplot_image(), but the ggplot_image() method is quite a bit slower as of today. If you need the full power of ggplot it’s totally worth it, but if you’re just adding sparklines I’m a big fan of kableExtra::spec_plot().
Then we can create a range to set baselines for MPG, and then use kableExtra::spec_plot() to embed an inline sparkline. Note we have to use purrr::map() here to apply the function iteratively across each row.
Now that I’ve showed that it’s possible, what are we actually doing? kableExtra::spec_plot() creates a plot in base R, and then returns it as either svg or pdf, which means it can be compatible with either HTML or LaTeX. Remember the mpg_list we created by splitting the mpg column into a list of vectors by cyl?
List of 7
$ path : chr(0)
$ dev : chr "svg"
$ type : chr "line"
$ width : num 200
$ height : num 50
$ res : num 300
$ svg_text: chr "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www."| __truncated__
- attr(*, "class")= chr [1:2] "kableExtraInlinePlots" "list"
We see that it returns a list object, with mostly metadata about what parameters were passed to the function. The part we really want is the svg_text since that has the xml code to generate our inline plot. We can pull out the svg_text list item from our list of lists by calling map("svg_text"). Now we can see each of the svg-plots, one for each cylinder group!
So now that we have the specific item of interest we need to let gt “know” to treat this as HTML and not just a random character string. We can call map() one more time and apply the gt::html() function to each svg plot.
And that’s why the following code works:
- Group by cylinder
- Summarize down to a list-column of the respective MPG column by cylinder
- Create the spec_plot object
- Extract the svg_text
- Recognize the svg_text as HTML
- gt takes the HTML and parses it
While that works just fine, it assumes that you create the content ahead of time, before incorporating it into gt. However, you can also approach it from within gt itself.
For the next one, I have a more general function to use.
The custom function gt_plot():
- Takes the table data from gt
- You specify a specific column
- You specify external data to plot
- Specify what type of plot
- Optionally pass additional arguments to spec_plot with ...
gt_plot<-function(table_data, column, plot_data, plot_fun, ...){text_transform(table_data,
# note the use of {{}} here - this is tidy eval# that allows you to indicate specific columns
locations =cells_body(columns =vars({{column}})),
fn =function(x){plot<-map(plot_data, plot_fun, width =300, height =70, same_lim =TRUE, ...)plot_svg<-map(plot, "svg_text")map(plot_svg, gt::html)})}
Note that again, my table “data” is pretty minimal, and I’ve got the data externally as our mpg_list object we created earlier.
List of 3
$ 4: num [1:11] 22.8 24.4 22.8 32.4 30.4 33.9 21.5 27.3 26 30.4 ...
$ 6: num [1:7] 21 21 21.4 18.1 19.2 17.8 19.7
$ 8: num [1:14] 18.7 14.3 16.4 17.3 15.2 10.4 10.4 14.7 15.5 15.2 ...
tibble(cyl =c(4,6,8), boxplot ="")%>%gt()%>%gt_plot(
column =boxplot, # column to create plot in
plot_data =mpg_list, # external data to reference
plot_fun =spec_boxplot, # which plot fun
lim =mpg_rng# range applied)
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
boxplot
4
6
8
We can quickly switch from a boxplot to a sparkline, just by changing the plot_fun argument to spec_plot. Also since I passed ellipses (...) to the spec_plot() function we can also use some additional arguments to change the line-color to black, and make the max/min points to be a bit larger.
tibble(cyl =c(4,6,8), boxplot ="")%>%gt()%>%gt_plot(
column =boxplot, # column to create plot in
plot_data =mpg_list, # external data to reference
plot_fun =spec_plot, # which plot fun
ylim =mpg_rng, # range applied,
col ="black", # change color of line
cex =5# change size of points)
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
boxplot
4
6
8
This works with all the kableExtra inline plot functions! Note that we are just varying the ylim on the line/points 1 vs 2, where the mpg_line1/mpg_points1 share a common y-axis, and line2/points2 have their own y-axis.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
boxplot
mpg_hist
mpg_line1
mpg_line2
mpg_points1
mpg_points2
mpg_poly
4
6
8
Use a single source of data
OK so we now have a function, but we’re referencing an external data object, rather than data within the “table” itself - not ideal!
Can we just use our group_by + summarize as list from before without any changes? (Spoiler = nope)
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning in xy.coords(x, y, xlabel, ylabel, log): NAs introduced by coercion
Warning in which.min(y): NAs introduced by coercion
Warning in which.max(y): NAs introduced by coercion
Warning in xy.coords(x, y, xlabel, ylabel, log): NAs introduced by coercion
Warning in which.min(y): NAs introduced by coercion
Warning in which.max(y): NAs introduced by coercion
Warning in xy.coords(x, y, xlabel, ylabel, log): NAs introduced by coercion
Warning in which.min(y): NAs introduced by coercion
Warning in which.max(y): NAs introduced by coercion
cyl
data
4
6
8
Nope - but it does give us a decent error message!
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In which.min(y) : NAs introduced by coercion
3: In which.max(y) : NAs introduced by coercion
There seems to be a type conversion - NAs are being returned where we expect numeric data to create the x-y coordinates for the plot. Let’s dive a bit closer into what happens when we call text_transform(). I’m calling str() inside our text_transform() now to expose what the data itself looks like.
List of 3
$ : chr "22.8, 24.4, 22.8, 32.4, 30.4, 33.9, 21.5, 27.3, 26.0, 30.4, 21.4"
$ : chr "21.0, 21.0, 21.4, 18.1, 19.2, 17.8, 19.7"
$ : chr "18.7, 14.3, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 15.5, 15.2, 13.3, 19.2, 15.8, 15.0"
Error: Assigned data `*vtmp*` must be compatible with existing data.
x Existing data has 3 rows.
x Assigned data has 0 rows.
ℹ Only vectors of size 1 are recycled.
This tells us something interesting! It’s combined all the vectors into a character string separated by commas. No wonder our graph can’t understand its xy coords, it is passed as one long text string!
Now if we’re tricky, we can get at the guts of gt since it’s just a list object. There’s quite a bit there inside the gt object, but the first list item is arguably the most important! We have the raw data as _data!
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
mpg_data
4
6
8
That worked beautifully!
An alternative that doesn’t require going into the gt object itself and coerces the character string back into numeric. This is a bit clunkier, but totally possible.
# WORKSmtcars%>%group_by(cyl)%>%summarize(mpg_data =list(as.double(mpg)), .groups ="drop")%>%gt()%>%text_transform(
locations =cells_body(columns =vars(mpg_data)),
fn =function(x){# split the strings at each commasplit_data<-str_split(x, ", ")# convert to type doubledata<-map(split_data, as.double)# create the plotplot<-map(data, ~spec_plot(.x, ylim =mpg_rng, same_lim =TRUE, width =300, height =70))# extract the svg itemmap(plot, "svg_text")})
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
mpg_data
4
6
8
Ok so we’ve shown that it’s possible to do that either way, so let’s rewrite our function!
gt_plot<-function(table_data, plot_col, data_col, plot_fun, ...){# save the data extract ahead of time # to be used in our anonymous function belowdata_in=pluck(table_data, "_data", data_col)text_transform(table_data,
# note the use of {{}} here - this is tidy eval# that allows you to indicate specific columns
locations =cells_body(columns =vars({{plot_col}})),
fn =function(x){plot<-map(data_in, plot_fun, width =300, height =70, same_lim =FALSE, ...)plot_svg<-map(plot, "svg_text")map(plot_svg, gt::html)})}
This function will now work exactly as expected with the grouped list data columns!
# works!mtcars%>%group_by(cyl)%>%summarize(mpg_data =list(mpg), .groups ="drop")%>%gt()%>%# note you can leave mpg_data unquoted for the tidyeval# but have to quote mpg_data for the pluckgt_plot(mpg_data, "mpg_data", plot_fun =spec_plot)
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
mpg_data
4
6
8
Interactive sparklines
So the embedded sparklines as shown above are fantastic, quick and robust, but they’re static. Since we’re focusing on HTML content, why don’t we also see if we can get javascript enabled interactivity?
Quick example of this working below, but note you need to call sparkline(0) somewhere ahead of time in your RMarkdown doc to load the javascript library dependency. Also, if you try to view this interactively it will look like it failed and didn’t pass anything through, but it will work when the RMarkdown is knit and the JavaScript can be called properly.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
var
sparkline1
sparkline2
box
mpg
wt
While we’re likely to only be using this in a table once per each , I do want to try and create a function so that we don’t have to re-write these each time and could potentially roll it into a package.
gt_spark<-function(table_data, plot_col, data_col){# save the data extract ahead of time # to be used in our anonymous function belowdata_in=pluck(table_data, "_data", data_col)text_transform(table_data,
# note the use of {{}} here - this is tidy eval# that allows you to indicate specific columns
locations =cells_body(columns =vars({{plot_col}})),
fn =function(x){sparkline_plot<-map(data_in,
~spk_chr(values =.x, chartRangeMin =0))map(sparkline_plot, gt::html)})}
We can then apply the function to work very succinctly, referencing only the internal list-column data.
# works!mtcars%>%group_by(cyl)%>%summarize(mpg_data =list(mpg), .groups ="drop")%>%gt()%>%# note you can leave mpg_data unquoted for the tidyeval# but have to quote mpg_data for the pluckgt_spark(mpg_data, "mpg_data")
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
cyl
mpg_data
4
6
8
Forest
You can also make forest-plot like tables in gt, note that this code is taken essentially verbatim from kableExtra’s documentation, just adapted to work in gt.
For the next section, I’ll be showing some functions that are mostly adapted from Greg Lin’s fantastic examples for the reactable package Cookbook. I love reactable, but want to show how some of the same ideas can translate in to mostly static tables as well. Note that some of the tags$, div, etc are from the htmltools package, and you can generally write your own HTML by hand if you wanted.
Function to add tooltip to a table column label
library(htmltools)# Add tooltip to column labelswith_tooltip<-function(value, tooltip){tags$abbr(style ="text-decoration: underline; text-decoration-style: solid; cursor: question; color: blue",
title =tooltip, value)}
Function that creates a star rating scale from 0-5
# note you could use ANY font-awesome logo# https://fontawesome.com/cheatsheetrating_stars<-function(rating, max_rating=5){rounded_rating<-floor(rating+0.5)# always round upstars<-lapply(seq_len(max_rating), function(i){if(i<=rounded_rating)fontawesome::fa("star", fill="orange")elsefontawesome::fa("star", fill="grey")})label<-sprintf("%s out of %s", rating, max_rating)div_out<-div(title =label, "aria-label"=label, role ="img", stars)as.character(div_out)%>%gt::html()}
fontawesome package for inline icons
rank_chg<-function(change_dir){if(change_dir=="increase"){logo_out<-fontawesome::fa("arrow-up", fill ="blue")}elseif(change_dir=="decrease"){logo_out<-fontawesome::fa("arrow-down", fill ="red")}logo_out%>%as.character()%>%gt::html()}
Create a “badge” style label with a specific color, and round edges.
All of these examples can be used in one example table! I’ve also added a HTML example of a hyperlink for the “data source” which links to the gt page for HTML content 😄. So now we have:
- Tooltips
- Embedded icons/font-awesome logos
- Badges + colors
- HTML-only bar charts
- Hyperlinks
- Expandable Tabke Key as “Details” with a HTML <details> tag
Let’s put all the things we’ve learned together into a publication-quality table, we’ll collect some QBR data to use.
# use espnscrapeR to get NFL standings + QBR ratingsnfl_qbr<-get_nfl_qbr(2020)
Scraping QBR totals for 2020!
nfl_standings<-get_nfl_standings(2020)
Returning 2020
# also get weekly for embedded plotqbr_weekly<-crossing(season =2020, week =1:8)%>%pmap_dfr(.f =get_nfl_qbr)
Scraping weekly QBR for week 1 of 2020!
Scraping weekly QBR for week 2 of 2020!
Scraping weekly QBR for week 3 of 2020!
Scraping weekly QBR for week 4 of 2020!
Scraping weekly QBR for week 5 of 2020!
Scraping weekly QBR for week 6 of 2020!
Scraping weekly QBR for week 7 of 2020!
Scraping weekly QBR for week 8 of 2020!
Then we’ll summarise the data to prep for an embedded plot, and join together our NFL standings, QBR, and weekly QBR.
Data Prep
qbr_match<-qbr_weekly%>%filter(name_short%in%unique(nfl_qbr$name_short))%>%group_by(name_short, team)%>%summarise(qbr_weekly =list(qbr_total), .groups ="drop",
qbr =mean(qbr_total),
qbr_sd =sd(qbr_total),
plays =sum(qb_plays),
pass =mean(pass),
run =mean(run),
head =unique(headshot_href),
n =n())%>%arrange(desc(qbr))%>%filter(n>=7)# clean up the data a bit and combinetab_df<-qbr_match%>%left_join(nfl_standings, by =c("team"="team_name"))%>%select(name_short, team, head, qbr_weekly:run, wins, losses, pts_for)%>%mutate(wl =glue("{wins}-{losses}"))%>%select(-wins, -losses)tab_df
# A tibble: 23 × 11
name_short team head qbr_weekly qbr qbr_sd plays pass run pts_for
<chr> <chr> <chr> <list> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 R. Wilson Seahaw… http… <dbl [7]> 77.0 9.57 328 7.43 1.17 459
2 A. Rodgers Packers http… <dbl [7]> 73.2 29.9 285 6.3 0.586 509
3 P. Mahomes Chiefs http… <dbl [8]> 72.1 20.8 347 7.22 1.29 473
4 D. Brees Saints http… <dbl [7]> 70.1 13.1 280 6.31 0.171 482
5 J. Allen Bills http… <dbl [8]> 69.9 20.9 362 6.64 1.21 501
6 R. Tannehill Titans http… <dbl [7]> 68.8 20.3 284 5.81 1.13 491
7 D. Carr Raiders http… <dbl [7]> 66.2 19.9 284 5.69 0.357 434
8 M. Ryan Falcons http… <dbl [8]> 64.9 28.3 370 5.54 0.662 396
9 K. Murray Cardin… http… <dbl [7]> 64.2 20.8 340 3.81 2.69 410
10 T. Brady Buccan… http… <dbl [8]> 62.2 25.9 349 5.88 -0.262 492
# … with 13 more rows, and 1 more variable: wl <glue>
# A tibble: 35 × 4
name_short qbr rank_chg rank
<chr> <dbl> <dbl> <dbl>
1 R. Wilson 77.0 0 1
2 A. Rodgers 73.2 1 2
3 P. Mahomes 72.1 5 3
4 D. Prescott 71.5 1 4
5 D. Brees 70.1 1 5
6 J. Allen 69.9 -4 6
7 R. Tannehill 68.8 -3 7
8 J. Herbert 68.7 3 8
9 K. Allen 68.2 0 9
10 R. Fitzpatrick 67.6 0 10
# … with 25 more rows
We can then combine the player name, team, and win-loss record into one set of “data” presented with some HTML formatting.
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = TRUE` has been deprecated in gt 0.3.0:
* please use `columns = everything()` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
* please use `columns = c(...)` instead
So that’s all for now, but hopefully having this “cheatsheet” lets you go even further with all the possible creations you can make with a lot of gt and a little bit of HTML!