Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
78ae421
Update a11y guide with info about how to escape special characters in…
sbreitbart-NOAA Feb 16, 2026
3cf3a0f
Update readme example create_template() arg from 'author' to 'authors'
sbreitbart-NOAA Feb 16, 2026
c600ab3
Update ID_tbl_width_class() to work with gt tables, vs flextables
sbreitbart-NOAA Feb 16, 2026
1326b92
Update create_tables_doc() and related functions so begin replacing f…
sbreitbart-NOAA Feb 16, 2026
4e1a5a3
create new function to get table length; update documentation
sbreitbart-NOAA Feb 17, 2026
f5906c9
Redesign tables doc workflow to work with >1 tables shown on portrait…
sbreitbart-NOAA Feb 23, 2026
70c188b
Redesign tables doc workflow to work with >1 table shown on landscape…
sbreitbart-NOAA Feb 23, 2026
87759ef
Redesign tables doc workflow to work with remaining types of tables
sbreitbart-NOAA Feb 24, 2026
217d528
update tests by removing flextable and replacing with gt
sbreitbart-NOAA Feb 24, 2026
8a42396
sub flextable with gt in DESCRIPTION and devcontainer
sbreitbart-NOAA Feb 24, 2026
0f50a27
create tests for ID_tbl_length_class()
sbreitbart-NOAA Feb 24, 2026
ba1326a
Update tests
sbreitbart-NOAA Feb 24, 2026
4f8de4d
Update captions for split tables by removing individual column names …
sbreitbart-NOAA Feb 24, 2026
342437e
Update render_lg_table() to work with varying essential column values…
sbreitbart-NOAA Feb 25, 2026
c7d63e5
Delete unusable, duplicated license
sbreitbart-NOAA Feb 25, 2026
83f0b7b
Address warnings in R cmd check
sbreitbart-NOAA Feb 25, 2026
91207ae
Comment out code that restricts table column width unnecessarily, sin…
sbreitbart-NOAA Feb 25, 2026
4283149
Edit add_child() to add line to tables chunk in skeleton to add "cle…
sbreitbart-NOAA Feb 25, 2026
1340050
Update captions for tables split by columns to remove mention of spec…
sbreitbart-NOAA Feb 25, 2026
38a4c85
Set col widths for tables; fix issue with extra-wide tables
sbreitbart-NOAA Feb 26, 2026
502788f
Add missing pipes to create_tables_doc()
sbreitbart-NOAA Feb 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"packages": "qpdf"
},
"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
"packages": "usethis,pak,qpdf,cli,flextable,forstringr,fs,naniar,officer,pdftools,prodlim,svDialogs,tidyselect,tinytex",
"packages": "usethis,pak,qpdf,cli,gt,forstringr,fs,naniar,officer,pdftools,prodlim,svDialogs,tidyselect,tinytex",
"installSystemRequirements": true
},
// option to run rstudio. you can type rserver into the command line to
Expand Down
4 changes: 1 addition & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ Imports:
cli,
data.table,
dplyr,
flextable,
forstringr,
fs,
glue,
gt,
naniar,
officer,
purrr,
stats,
stringi,
Expand All @@ -42,7 +41,6 @@ Imports:
utils
Suggests:
ggplot2,
gt,
kableExtra,
knitr,
parallel,
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(ID_tbl_length_class)
export(ID_tbl_width_class)
export(add_accessibility)
export(add_alttext)
Expand Down
47 changes: 47 additions & 0 deletions R/ID_tbl_length_class.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#' Identify table length class
#'
#' @inheritParams render_lg_table
#'
#' @return The length class of a table: regular or long. The result
#' will determine whether the table can be rendered on a page
#' as-is, or if it needs to be split across multiple pages.
#' @export
#'
#' @examples
#' \dontrun{
#' ID_tbl_length_class(
#' plot_name = "indices.abundance_table.rda",
#' tables_dir = here::here()
#' )
#' }
ID_tbl_length_class <- function(
tables_dir,
plot_name
) {
tables_path <- fs::path(
tables_dir,
"tables",
paste0(plot_name, "_table.rda")
)

if (file.exists(tables_path)) {
load(tables_path)
table_rda <- rda
rm(rda)
gt_table <- table_rda$table

# Get table length in rows
table_length <- nrow(gt_table[["_data"]])

# determine table length class
if (table_length <= 38) {
length_class <- "regular" # fit on one landscape page (and, by default, portrait)
} else {
length_class <- "long" # divided across >1 landscape page
}
} else {
cli::cli_abort(message = "Table not found at {tables_path}")
}

length_class
}
11 changes: 8 additions & 3 deletions R/ID_tbl_width_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' be resized, rotated, and/or split across multiple pages.
#'
#' @return The width class of a table: regular, wide, or extra-wide. The result
#' will determine whether the table that can be rendered on a portrait page
#' will determine whether the table can be rendered on a portrait page
#' as-is, or if it needs to be resized, rotated, and/or split across multiple pages.
#' @export
#'
Expand All @@ -34,9 +34,14 @@ ID_tbl_width_class <- function(
load(tables_path)
table_rda <- rda
rm(rda)
table_width <- flextable::flextable_dim(table_rda$table)[["widths"]] |>
as.numeric()
gt_table <- table_rda$table

# Set each col to 1.5"
col_inches <- 1.5

# Calculate total table width in inches
table_width <- ncol(gt_table[["_data"]]) * col_inches

# determine table width class
if (table_width <= portrait_pg_width) {
width_class <- "regular"
Expand Down
4 changes: 4 additions & 0 deletions R/add_child.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ add_child <- function(x,
"#| warning: false", "\n",
"a <- knitr::knit_child(", "'", sec_num, "'", ", quiet = TRUE)", "\n",
"cat(a, sep = '\\n')", "\n",
# ifelse checks for the 'tables' label and injects the extra code/comment
ifelse(label[i] == "tables",
"# Force LaTeX to render all floating tables before moving to the next section\ncat('\\n\\\\clearpage\\n')\n",
""),
"```", "\n"
)
child <- paste(child, child_loop, sep = "\n {{< pagebreak >}} \n")
Expand Down
2 changes: 1 addition & 1 deletion R/asar-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ globvar <- c(
"row_rescale", "table_list", "read.csv", "All", "x", "Acronym", "Meaning",
"meaning_lower", "Definition", "n", "Label", "figures_doc_header",
"X", "len_bins", "area", "match_key", "uncertainty_label",
"word_count", "ac_short"
"word_count", "ac_short", "column_label"
)
if (getRversion() >= "2.15.1") utils::globalVariables(globvar)
Loading