From d0701e0d6bd46c768a83f8d4565df46a24f6b995 Mon Sep 17 00:00:00 2001 From: Izaak Jephson Date: Mon, 9 Sep 2024 14:17:20 +0100 Subject: [PATCH] Fix error in export_tables namespace --- R/export_tables.R | 26 +++++++++++++------------- README.Rmd | 3 ++- README.md | 3 ++- man/xlsss-package.Rd | 6 +++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/R/export_tables.R b/R/export_tables.R index 1fcb0fe..dab39f7 100644 --- a/R/export_tables.R +++ b/R/export_tables.R @@ -206,13 +206,13 @@ format_columns <- function(wb, ) } - # Format £ columns - if (str_detect(colnames(table[column]), "[Vv]alue")) { - addStyle(wb, sheet_name, - rows = start_row:end_row, - cols = column, - style = createStyle(numFmt = "£#,##0;-;£0", halign = "right"), - gridExpand = TRUE + # Format GBP columns + if (stringr::str_detect(colnames(table[column]), "[Vv]alue")) { + openxlsx::addStyle(wb, sheet_name, + rows = start_row:end_row, + cols = column, + style = openxlsx::createStyle(numFmt = "£#,##0;-;£0", halign = "right"), + gridExpand = TRUE ) } @@ -247,12 +247,12 @@ format_rows <- function(wb, ) } # Format % rows - else if (str_starts(table[[table_row, 1]],"Percentage")) { - addStyle(wb, sheet_name, - rows = sheet_row, - cols = 2:end_col, - style = createStyle(numFmt = "0%;-;0%", halign = "right"), - gridExpand = TRUE + else if (stringr::str_starts(table[[table_row, 1]],"Percentage")) { + openxlsx::addStyle(wb, sheet_name, + rows = sheet_row, + cols = 2:end_col, + style = openxlsx::createStyle(numFmt = "0%;-;0%", halign = "right"), + gridExpand = TRUE ) } diff --git a/README.Rmd b/README.Rmd index 4fb4925..6b7ea7a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -27,7 +27,8 @@ You can install the development version of xlsss from [GitHub](https://github.co ``` r # install.packages("devtools") -devtools::install_github("ScotGovAnalysis/xlsss") +devtools::install_github("ScotGovAnalysis/xlsss", + upgrade = "never") ``` ## Getting started diff --git a/README.md b/README.md index e14f027..b36e881 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ You can install the development version of xlsss from ``` r # install.packages("devtools") -devtools::install_github("ScotGovAnalysis/xlsss") +devtools::install_github("ScotGovAnalysis/xlsss", + upgrade = "never") ``` ## Getting started diff --git a/man/xlsss-package.Rd b/man/xlsss-package.Rd index 78f8c08..3720103 100644 --- a/man/xlsss-package.Rd +++ b/man/xlsss-package.Rd @@ -4,12 +4,12 @@ \name{xlsss-package} \alias{xlsss} \alias{xlsss-package} -\title{xlsss: What the Package Does (One Line, Title Case)} +\title{xlsss: Automate Accessible Table Production for Social Security Scotland} \description{ -What the package does (one paragraph). +Automates the process of outputting statistical tables to excel in a format that complies with accessibility requirements. } \author{ -\strong{Maintainer}: First Last \email{first.last@example.com} (\href{https://orcid.org/YOUR-ORCID-ID}{ORCID}) +\strong{Maintainer}: Izaak Jephson \email{first.last@example.com} } \keyword{internal}