ixodid
1
Thinking about Tufte's data-ink ratio is there an easy way to remove the following from the basic gt
table below:
- remove top line and bottom two lines
- remove shading on bottom row
library(gt)
can_world_table <- tibble(
region = c("Canada", "World"),
target_year = c(20123456, 3479525000),
current_year = c(38987654, 7713852000)
)
gt(can_world_table) %>%
tab_header(
title = "Population",
subtitle = "(in millions)"
) %>%
cols_label(
region = "",
target_year = "1967",
current_year = "2019"
) %>%
fmt_number(
columns = vars(target_year, current_year),
decimals = 0,
scale_by = 1e-6
) %>%
cols_align(
align = "right",
columns = vars(target_year, current_year)
)
The tab_options() function seems to help.
Not all the way there.
This reference page should help
https://www.rdocumentation.org/packages/gt/versions/0.1.0/topics/tab_options
library(gt)
library(tidyverse)
can_world_table <- tibble(
region = c("Canada", "World"),
target_year = c(20123456, 3479525000),
current_year = c(38987654, 7713852000)
)
gt(can_world_table) %>%
tab_header(
title = "Population",
subtitle = "(in millions)"
) %>%
cols_label(
region = "",
target_year = "1967",
current_year = "2019"
) %>%
fmt_number(
columns = vars(target_year, current_year),
decimals = 0,
scale_by = 1e-6
) %>%
cols_align(
align = "right",
columns = vars(target_year, current_year)
) %>%
tab_options(
row.striping.include_table_body =FALSE,
table.border.top.color = "white",
heading.border.bottom.color = "white",
row_group.border.bottom.color = "white",
row_group.border.top.color = "white")
html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
}
#qbpnwpzrlj .gt_table {
display: table;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
color: #333333;
font-size: 16px;
background-color: #FFFFFF;
/* table.background.color */
width: auto;
/* table.width */
border-top-style: solid;
/* table.border.top.style */
border-top-width: 2px;
/* table.border.top.width */
border-top-color: white;
/* table.border.top.color */
border-bottom-style: solid;
/* table.border.bottom.style */
border-bottom-width: 2px;
/* table.border.bottom.width */
border-bottom-color: #A8A8A8;
/* table.border.bottom.color */
}
#qbpnwpzrlj .gt_heading {
background-color: #FFFFFF;
/* heading.background.color */
border-bottom-color: #FFFFFF;
}
#qbpnwpzrlj .gt_title {
color: #333333;
font-size: 125%;
/* heading.title.font.size */
padding-top: 4px;
/* heading.top.padding - not yet used */
padding-bottom: 4px;
border-bottom-color: #FFFFFF;
border-bottom-width: 0;
}
#qbpnwpzrlj .gt_subtitle {
color: #333333;
font-size: 85%;
/* heading.subtitle.font.size */
padding-top: 0;
padding-bottom: 4px;
/* heading.bottom.padding - not yet used */
border-top-color: #FFFFFF;
border-top-width: 0;
}
#qbpnwpzrlj .gt_bottom_border {
border-bottom-style: solid;
/* heading.border.bottom.style */
border-bottom-width: 2px;
/* heading.border.bottom.width */
border-bottom-color: white;
/* heading.border.bottom.color */
}
#qbpnwpzrlj .gt_column_spanner {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
padding-top: 4px;
padding-bottom: 4px;
}
#qbpnwpzrlj .gt_col_heading {
color: #333333;
background-color: #FFFFFF;
/* column_labels.background.color */
font-size: 16px;
/* column_labels.font.size */
font-weight: initial;
/* column_labels.font.weight */
vertical-align: middle;
padding: 5px;
margin: 10px;
overflow-x: hidden;
}
#qbpnwpzrlj .gt_columns_top_border {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
}
#qbpnwpzrlj .gt_columns_bottom_border {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
}
#qbpnwpzrlj .gt_sep_right {
border-right: 5px solid #FFFFFF;
}
#qbpnwpzrlj .gt_group_heading {
padding: 8px;
/* row_group.padding */
color: #333333;
background-color: #FFFFFF;
/* row_group.background.color */
font-size: 16px;
/* row_group.font.size */
font-weight: initial;
/* row_group.font.weight */
border-top-style: solid;
/* row_group.border.top.style */
border-top-width: 2px;
/* row_group.border.top.width */
border-top-color: white;
/* row_group.border.top.color */
border-bottom-style: solid;
/* row_group.border.bottom.style */
border-bottom-width: 2px;
/* row_group.border.bottom.width */
border-bottom-color: white;
/* row_group.border.bottom.color */
vertical-align: middle;
}
#qbpnwpzrlj .gt_empty_group_heading {
padding: 0.5px;
color: #333333;
background-color: #FFFFFF;
/* row_group.background.color */
font-size: 16px;
/* row_group.font.size */
font-weight: initial;
/* row_group.font.weight */
border-top-style: solid;
/* row_group.border.top.style */
border-top-width: 2px;
/* row_group.border.top.width */
border-top-color: white;
/* row_group.border.top.color */
border-bottom-style: solid;
/* row_group.border.bottom.style */
border-bottom-width: 2px;
/* row_group.border.bottom.width */
border-bottom-color: white;
/* row_group.border.bottom.color */
vertical-align: middle;
}
#qbpnwpzrlj .gt_striped {
background-color: #8080800D;
}
#qbpnwpzrlj .gt_from_md > :first-child {
margin-top: 0;
}
#qbpnwpzrlj .gt_from_md > :last-child {
margin-bottom: 0;
}
#qbpnwpzrlj .gt_row {
padding: 8px;
/* row.padding */
margin: 10px;
border-top-style: solid;
border-top-width: 1px;
border-top-color: #D3D3D3;
vertical-align: middle;
overflow-x: hidden;
}
#qbpnwpzrlj .gt_stub {
border-right-style: solid;
border-right-width: 2px;
border-right-color: #D3D3D3;
padding-left: 12px;
}
#qbpnwpzrlj .gt_summary_row {
color: #333333;
background-color: #FFFFFF;
/* summary_row.background.color */
padding: 8px;
/* summary_row.padding */
text-transform: inherit;
/* summary_row.text_transform */
}
#qbpnwpzrlj .gt_grand_summary_row {
color: #333333;
background-color: #FFFFFF;
/* grand_summary_row.background.color */
padding: 8px;
/* grand_summary_row.padding */
text-transform: inherit;
/* grand_summary_row.text_transform */
}
#qbpnwpzrlj .gt_first_summary_row {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
}
#qbpnwpzrlj .gt_first_grand_summary_row {
border-top-style: double;
border-top-width: 6px;
border-top-color: #D3D3D3;
}
#qbpnwpzrlj .gt_table_body {
border-top-style: solid;
/* table_body.border.top.style */
border-top-width: 2px;
/* table_body.border.top.width */
border-top-color: #D3D3D3;
/* table_body.border.top.color */
border-bottom-style: solid;
/* table_body.border.bottom.style */
border-bottom-width: 2px;
/* table_body.border.bottom.width */
border-bottom-color: #D3D3D3;
/* table_body.border.bottom.color */
}
#qbpnwpzrlj .gt_footnotes {
border-top-style: solid;
/* footnotes.border.top.style */
border-top-width: 2px;
/* footnotes.border.top.width */
border-top-color: #D3D3D3;
/* footnotes.border.top.color */
}
#qbpnwpzrlj .gt_footnote {
font-size: 90%;
/* footnote.font.size */
margin: 0px;
padding: 4px;
/* footnote.padding */
}
#qbpnwpzrlj .gt_sourcenotes {
border-top-style: solid;
/* sourcenotes.border.top.style */
border-top-width: 2px;
/* sourcenotes.border.top.width */
border-top-color: #D3D3D3;
/* sourcenotes.border.top.color */
}
#qbpnwpzrlj .gt_sourcenote {
font-size: 90%;
/* sourcenote.font.size */
padding: 4px;
/* sourcenote.padding */
}
#qbpnwpzrlj .gt_center {
text-align: center;
}
#qbpnwpzrlj .gt_left {
text-align: left;
}
#qbpnwpzrlj .gt_right {
text-align: right;
font-variant-numeric: tabular-nums;
}
#qbpnwpzrlj .gt_font_normal {
font-weight: normal;
}
#qbpnwpzrlj .gt_font_bold {
font-weight: bold;
}
#qbpnwpzrlj .gt_font_italic {
font-style: italic;
}
#qbpnwpzrlj .gt_super {
font-size: 65%;
}
#qbpnwpzrlj .gt_footnote_marks {
font-style: italic;
font-size: 65%;
}
Population
|
(in millions)
|
|
1967
|
2019
|
Canada
|
20
|
39
|
World
|
3,480
|
7,714
|
Created on 2019-10-12 by the reprex package (v0.3.0)
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.