Skip to content

Commit

Permalink
French update prop female appendix
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrandin committed Oct 21, 2024
1 parent 00ecee8 commit 0a672f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions R/table-prop-female.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions man/table_prop_female.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0a672f0

Please sign in to comment.