From 0a672f0315c1373a9b6db4145425b2c67af72388 Mon Sep 17 00:00:00 2001 From: Chris Grandin Date: Sun, 20 Oct 2024 22:23:31 -0700 Subject: [PATCH] French update prop female appendix --- R/table-prop-female.R | 14 ++++++++++---- man/table_prop_female.Rd | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/R/table-prop-female.R b/R/table-prop-female.R index 5030f47..93510ea 100644 --- a/R/table-prop-female.R +++ b/R/table-prop-female.R @@ -16,6 +16,7 @@ #' all years will be included #' @param ret_means Logical. If `TRUE`, return a list of the gear mean values. #' Takes priority over `ret_df` +#' @param bold_headers If `TRUE`, make all column headers bold #' #' @return A [csasdown::csas_table()] #' @importFrom csasdown csas_table @@ -27,6 +28,7 @@ table_prop_female <- function(prop_lst, format = "latex", yrs = NULL, ret_means = FALSE, + bold_headers = TRUE, ...){ ct_sym <- sym(tr("Commercial trawl")) @@ -55,7 +57,7 @@ table_prop_female <- function(prop_lst, filter(Year <= end_yr) |> mutate(Year = as.character(Year)) - means <- vec2df(c("Mean", f(map_dbl(d[-1], ~{mean(.x, na.rm = TRUE)}), 2)), + means <- vec2df(c(tr("Mean"), f(map_dbl(d[-1], ~{mean(.x, na.rm = TRUE)}), 2)), nms = names(k)) x <- bind_rows(k, means) @@ -75,9 +77,13 @@ table_prop_female <- function(prop_lst, if(return_df){ return(x) } - # Translate Year - x <- x |> - mutate(Year = tr("Year")) + + # Translate the Year column header only + names(x) <- gsub("Year", tr("Year"), names(x)) + + if(bold_headers){ + names(x) <- paste0("\\textbf{", names(x), "}") + } out <- csas_table(x, format = format, diff --git a/man/table_prop_female.Rd b/man/table_prop_female.Rd index 170cfe7..577a064 100644 --- a/man/table_prop_female.Rd +++ b/man/table_prop_female.Rd @@ -11,6 +11,7 @@ table_prop_female( format = "latex", yrs = NULL, ret_means = FALSE, + bold_headers = TRUE, ... ) } @@ -31,6 +32,8 @@ all years will be included} \item{ret_means}{Logical. If \code{TRUE}, return a list of the gear mean values. Takes priority over \code{ret_df}} +\item{bold_headers}{If \code{TRUE}, make all column headers bold} + \item{...}{Arguments passed to \code{\link[csasdown:csas_table]{csasdown::csas_table()}}} } \value{