From 574ccf526b2474a6d1e0cca8491c022072230d84 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:24:36 +0900 Subject: [PATCH 01/10] feat!: deprecate as_flextable.data.frame and recommend the native implementation by flextable --- R/as-flextable.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/R/as-flextable.R b/R/as-flextable.R index 8a7d5c2..976ef6f 100644 --- a/R/as-flextable.R +++ b/R/as-flextable.R @@ -79,6 +79,16 @@ as_flextable.grouped_df <- function( #' as_flextable() #' @export as_flextable.data.frame <- function(x, col_keys = names(x), ...) { + .Deprecated( + "flextable:::as_flextable.data.frame", + msg = paste( + "ftExtra:::as_flextable.data.frame is deprecated", + "and will be removed in the future release.", + "Consider using flextalbe's implementation by running", + '`.S3method("as_flextable", "data.frame",', + "flextable:::as_flextable.data.frame)`" + ) + ) if (is.function(col_keys)) col_keys <- col_keys(x) flextable::flextable(x, col_keys = col_keys, ...) } From a10079daeaf43ce1bb279ab38c10a28241fb8950 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:55:10 +0900 Subject: [PATCH 02/10] feat!: separate_header is renamed to split_header and the original one is deprecated --- R/header-transform.R | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/R/header-transform.R b/R/header-transform.R index b503053..7b84776 100644 --- a/R/header-transform.R +++ b/R/header-transform.R @@ -59,7 +59,10 @@ transform_header <- function( flextable::fix_border_issues() } -#' Separate the header based on delimiters +#' Split the header based on delimiters +#' +#' @note +#' `split_header` is a rename of `separate_header` and the latter will be removed in the future release. #' #' @param x A `flextable` object` #' @inheritParams tidyr::separate @@ -75,7 +78,7 @@ transform_header <- function( #' as_flextable() %>% #' separate_header() #' @export -separate_header <- function( +split_header <- function( x, sep = "[_\\.]", theme_fun = NULL, @@ -86,6 +89,27 @@ separate_header <- function( sep = sep, theme_fun = theme_fun, .fill = FALSE, .merge = FALSE, ... ) } + +#' @rdname split_header +#' @export +separate_header <- function( + x, + sep = "[_\\.]", + theme_fun = NULL, + ... +) { + .Deprecated( + "split_header", + msg = paste( + "ftExtra::separate_header will be removed in the future release", + "to avoid masking `flextable::separate_header`.", + "Instead, use ftExtra::split_header which is a copy of", + "ftExtra::separate_header." + ) + ) + split_header(x, sep, theme_fun, ...) +} + #' Span the header based on delimiters #' #' @inherit separate_header From 1e78ffdbb34bda8c955567c998761cf6e6ca1a00 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:56:51 +0900 Subject: [PATCH 03/10] fix: header transformation should not use backslash as a default separater --- R/header-transform.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/header-transform.R b/R/header-transform.R index 7b84776..57f1a79 100644 --- a/R/header-transform.R +++ b/R/header-transform.R @@ -80,7 +80,7 @@ transform_header <- function( #' @export split_header <- function( x, - sep = "[_\\.]", + sep = "[_.]", theme_fun = NULL, ... ) { @@ -94,7 +94,7 @@ split_header <- function( #' @export separate_header <- function( x, - sep = "[_\\.]", + sep = "[_.]", theme_fun = NULL, ... ) { @@ -123,7 +123,7 @@ separate_header <- function( #' @export span_header <- function( x, - sep = "[_\\.]", + sep = "[_.]", theme_fun = NULL, ... ) { From d3d3f0245a912cc0f34a2ba7e596460fca917a35 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:18:23 +0900 Subject: [PATCH 04/10] feat!: deprecate with_blanks --- R/with-blanks.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/with-blanks.R b/R/with-blanks.R index 4967fbb..26cf29d 100644 --- a/R/with-blanks.R +++ b/R/with-blanks.R @@ -6,7 +6,7 @@ insert_blanks <- function(after = NULL, before = NULL, data) { names(data), sprintf("..after%s", seq_along(.after)), sprintf("..before%s", seq_along(.before)) - )[order(c(seq(length(data)), .after, .before))] + )[order(c(seq_along(data), .after, .before))] } #' Specify blank columns easily via `col_keys` @@ -20,6 +20,9 @@ insert_blanks <- function(after = NULL, before = NULL, data) { #' as_flextable(col_keys = with_blanks(dplyr::ends_with("Width"))) #' @export with_blanks <- function(after = NULL, before = NULL) { + .Deprecated(msg = paste( + "This is a result of deprecating ftExtra:::as_flextable.data.frame" + )) after <- rlang::enquo(after) before <- rlang::enquo(before) function(data) insert_blanks(after = after, before = before, data = data) From 711bdb4080550909eb37e5f6696fcc4403ce59c9 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:19:26 +0900 Subject: [PATCH 05/10] feat: re-export flextable::flextable and remove usage of as_flextable --- NAMESPACE | 2 ++ R/footnote.R | 2 +- R/ftExtra.R | 4 +++ R/header-transform.R | 4 +-- tests/testthat/test-as-flextable.R | 28 ++++++++++----------- tests/testthat/test-header-transform.R | 4 +-- vignettes/format_columns.Rmd | 34 +++++++++++++------------- vignettes/transform-headers.Rmd | 2 +- 8 files changed, 43 insertions(+), 37 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index c45084f..d635acf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,10 +6,12 @@ export("%>%") export(as_flextable) export(as_paragraph_md) export(colformat_md) +export(flextable) export(footnote_options) export(separate_header) export(span_header) export(with_blanks) importFrom(flextable,as_flextable) +importFrom(flextable,flextable) importFrom(magrittr,"%>%") importFrom(rlang,.data) diff --git a/R/footnote.R b/R/footnote.R index 7cbe5ad..7533dda 100644 --- a/R/footnote.R +++ b/R/footnote.R @@ -22,7 +22,7 @@ #' #' @examples #' # A examole flextable with unprocessed markdown footnotes -#' ft <- as_flextable(tibble::tibble( +#' ft <- flextable(tibble::tibble( #' "header1^[note a]" = c("x^[note 1]", "y"), #' "header2" = c("a", "b^[note 2]") #' )) diff --git a/R/ftExtra.R b/R/ftExtra.R index 40a3184..54ad6b2 100644 --- a/R/ftExtra.R +++ b/R/ftExtra.R @@ -2,3 +2,7 @@ #' @importFrom magrittr %>% #' @export magrittr::`%>%` + +#' @importFrom flextable flextable +#' @export +flextable::flextable diff --git a/R/header-transform.R b/R/header-transform.R index 57f1a79..b95ae30 100644 --- a/R/header-transform.R +++ b/R/header-transform.R @@ -75,7 +75,7 @@ transform_header <- function( #' #' @examples #' iris %>% -#' as_flextable() %>% +#' flextable() %>% #' separate_header() #' @export split_header <- function( @@ -118,7 +118,7 @@ separate_header <- function( #' #' @examples #' iris %>% -#' as_flextable() %>% +#' flextable() %>% #' span_header() #' @export span_header <- function( diff --git a/tests/testthat/test-as-flextable.R b/tests/testthat/test-as-flextable.R index 5ff2c30..924ad61 100644 --- a/tests/testthat/test-as-flextable.R +++ b/tests/testthat/test-as-flextable.R @@ -1,9 +1,9 @@ x <- tibble::as_tibble(iris[c(1, 2, 51, 52), c(5, 1)]) -test_that("as_flextable.data.frame", { - expect_identical(as_flextable(x), flextable::flextable(x)) +test_that("flextable.data.frame", { + expect_identical(flextable(x), flextable::flextable(x)) expect_identical( - as_flextable(x, with_blanks("Species", "Sepal.Length")), + flextable(x, with_blanks("Species", "Sepal.Length")), flextable::flextable( x, col_keys = c("Species", "..after1", "..before1", "Sepal.Length") @@ -16,10 +16,10 @@ test_that("as.flextable.grouped_df", { d <- dplyr::group_by(x, .data$Species) f <- flextable::as_grouped_data(x, "Species") - expect_identical(as_flextable(d), as_flextable(f)) + expect_identical(flextable(d), as_flextable(f)) expect_identical( - as_flextable(d, groups_to = "merged"), + flextable(d, groups_to = "merged"), x %>% flextable::flextable() %>% flextable::merge_v("Species") %>% @@ -27,7 +27,7 @@ test_that("as.flextable.grouped_df", { ) expect_identical( - as_flextable(d, groups_to = "merged", col_keys = with_blanks("Species")), + flextable(d, groups_to = "merged", col_keys = with_blanks("Species")), x %>% flextable::flextable( col_keys = c("Species", "..after1", "Sepal.Length") @@ -37,12 +37,12 @@ test_that("as.flextable.grouped_df", { ) expect_identical( - as_flextable(d, groups_to = "asis"), + flextable(d, groups_to = "asis"), flextable::flextable(x) ) }) -test_that("as_flextable.grouped_df multi groups", { +test_that("flextable.grouped_df multi groups", { x <- mtcars %>% tibble::as_tibble(rownames = "model") %>% dplyr::select(model, cyl, mpg, disp, am) @@ -50,10 +50,10 @@ test_that("as_flextable.grouped_df multi groups", { dplyr::group_by(am, cyl, mpg) f <- flextable::as_grouped_data(x, groups = c("am", "cyl", "mpg")) - expect_identical(as_flextable(d), as_flextable(f)) + expect_identical(flextable(d), as_flextable(f)) expect_identical( - as_flextable(d, groups_to = "merged"), + flextable(d, groups_to = "merged"), x %>% dplyr::relocate(am, cyl, mpg) %>% flextable::flextable() %>% @@ -62,7 +62,7 @@ test_that("as_flextable.grouped_df multi groups", { ) expect_identical( - as_flextable(d, groups_to = "merged", groups_arrange = TRUE), + flextable(d, groups_to = "merged", groups_arrange = TRUE), x %>% dplyr::relocate(am, cyl, mpg) %>% dplyr::arrange(am, cyl, mpg) %>% @@ -72,7 +72,7 @@ test_that("as_flextable.grouped_df multi groups", { ) expect_identical( - as_flextable(d, groups_to = "merged", groups_pos = "asis"), + flextable(d, groups_to = "merged", groups_pos = "asis"), x %>% flextable::flextable() %>% flextable::merge_v(c("am", "cyl", "mpg")) %>% @@ -80,7 +80,7 @@ test_that("as_flextable.grouped_df multi groups", { ) expect_identical( - as_flextable( + flextable( d, groups_to = "merged", col_keys = with_blanks(tidyselect::starts_with("m")) @@ -95,7 +95,7 @@ test_that("as_flextable.grouped_df multi groups", { ) expect_identical( - as_flextable(d, groups_to = "asis"), + flextable(d, groups_to = "asis"), flextable::flextable(x) ) }) diff --git a/tests/testthat/test-header-transform.R b/tests/testthat/test-header-transform.R index 68e5ca0..9c285e3 100644 --- a/tests/testthat/test-header-transform.R +++ b/tests/testthat/test-header-transform.R @@ -30,14 +30,14 @@ test_that("merge_header", { test_that("separate-header", { expect_identical( - d %>% as_flextable() %>% separate_header(), + d %>% flextable() %>% separate_header(), ft %>% flextable::theme_booktabs() %>% flextable::fix_border_issues() ) }) test_that("span-header", { expect_identical( - d %>% as_flextable() %>% span_header(), + d %>% flextable() %>% span_header(), flextable::flextable(d) %>% flextable::set_header_df(h %>% fill_header(), key = "original") %>% merge_header() %>% diff --git a/vignettes/format_columns.Rmd b/vignettes/format_columns.Rmd index 83014a0..8af0541 100644 --- a/vignettes/format_columns.Rmd +++ b/vignettes/format_columns.Rmd @@ -86,7 +86,7 @@ The **ftExtra** package provides easy solution by introducing markdown. As markdown texts self-explain their formats by plain texts, what users have to do is manipulations of character columns with their favorite tools such as the famous **dplyr** and **stringr** packages. 1. Preprocess a data frame to decorate texts with markdown syntax. -2. Convert the data frame into a flextable object with the `flextable` function or `as_flextable` function. +2. Convert the data frame into a flextable object with the `flextable` function or `flextable` function. 3. Format markdown columns with `colformat_md` The following example elegantly simplifies the prior example. @@ -133,7 +133,7 @@ data.frame( ), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() ``` @@ -174,7 +174,7 @@ data.frame( description = "Extensions for 'Flextable'^[Supports of footnotes]", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.5) ``` @@ -188,7 +188,7 @@ data.frame( description = "Extensions for 'Flextable'^[Supports of footnotes]", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md( .footnote_options = footnote_options( ref = "i", @@ -214,7 +214,7 @@ data.frame( [^b]: bbb", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() ``` @@ -250,7 +250,7 @@ tibble::tibble( "header1^[note a]" = c("x^[note 1]", "y"), "header2" = c("a", "b^[note 2]") ) %>% - as_flextable() %>% + flextable() %>% # process header first colformat_md( part = "header", .footnote_options = footnote_options(ref = ref) @@ -286,7 +286,7 @@ data.frame( R = sprintf("![](%s)", file.path(R.home("doc"), "html", "logo.jpg")), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit() ``` @@ -299,7 +299,7 @@ By default, soft line breaks becomes spaces. ```{r} data.frame(linebreak = c("a\nb"), stringsAsFactors = FALSE) %>% - as_flextable() %>% + flextable() %>% colformat_md() ``` @@ -307,7 +307,7 @@ Pandoc's markdown supports hard line breaks by adding a backslash or double spac ```{r} data.frame(linebreak = c("a\\\nb"), stringsAsFactors = FALSE) %>% - as_flextable() %>% + flextable() %>% colformat_md() ``` @@ -315,7 +315,7 @@ It is also possible to make `\n` as a hard line break by extending Pandoc's Mark ```{r} data.frame(linebreak = c("a\nb"), stringsAsFactors = FALSE) %>% - as_flextable() %>% + flextable() %>% colformat_md(md_extensions = "+hard_line_breaks") ``` @@ -325,7 +325,7 @@ To workaround, `colformat_md` collapses them to a single paragraph with a separa ```{r} data.frame(linebreak = c("a\n\nb"), stringsAsFactors = FALSE) %>% - as_flextable() %>% + flextable() %>% colformat_md(.sep = "\n\n") ``` @@ -357,7 +357,7 @@ data.frame( Cite = c("@R-ftExtra", "[@R-ftExtra]", "[-@R-ftExtra]"), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.2) ``` @@ -376,7 +376,7 @@ data.frame( Cite = c("@R-ftExtra", "[@R-ftExtra]", "[-@R-ftExtra]"), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md(pandoc_args = c("--bibliography", tf)) %>% flextable::autofit(add_w = 0.2) ``` @@ -393,7 +393,7 @@ data.frame( math = "$e^{i\\theta} = \\cos \\theta + i \\sin \\theta$", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.2) ``` @@ -411,7 +411,7 @@ To use it with `colformat_md()`, specify `md_extensions="+emoji"`. ```{r} data.frame(emoji = c(":+1:"), stringsAsFactors = FALSE) %>% - as_flextable() %>% + flextable() %>% colformat_md(md_extensions = "+emoji") ``` @@ -425,7 +425,7 @@ data.frame( x = "H2O", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md(.from = "html") ``` @@ -438,6 +438,6 @@ data.frame( x = "foo\n\nbar", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md(.from = "commonmark") ``` diff --git a/vignettes/transform-headers.Rmd b/vignettes/transform-headers.Rmd index d52d9f4..2000f80 100644 --- a/vignettes/transform-headers.Rmd +++ b/vignettes/transform-headers.Rmd @@ -24,7 +24,7 @@ library(ftExtra) # Prepare flextable ```{r} -ft <- iris[1:2, ] %>% as_flextable +ft <- iris[1:2, ] %>% flextable ft ``` From 5eddaceaa475db6dab2c6b4ec6783160ca956a56 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:12:36 +0900 Subject: [PATCH 06/10] test: fix erros and warnings related to as_flextable --- R/as-flextable.R | 2 +- R/utils.R | 4 ++ tests/testthat/test-as-flextable.R | 54 +++++--------------------- tests/testthat/test-header-transform.R | 4 +- 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/R/as-flextable.R b/R/as-flextable.R index 976ef6f..a780e18 100644 --- a/R/as-flextable.R +++ b/R/as-flextable.R @@ -51,7 +51,7 @@ as_flextable.grouped_df <- function( x %>% dplyr::ungroup() %>% flextable::as_grouped_data(g) %>% - as_flextable(...) + flextable::as_flextable(...) ) } diff --git a/R/utils.R b/R/utils.R index 8a01add..5291750 100644 --- a/R/utils.R +++ b/R/utils.R @@ -16,3 +16,7 @@ drop_na <- function(x) { last <- function(x) { x[[length(x)]] } + +.Deprecated <- function(...) { + if (!getOption("ftExtra.ignore.deprecation", FALSE)) base::.Deprecated(...) +} diff --git a/tests/testthat/test-as-flextable.R b/tests/testthat/test-as-flextable.R index 924ad61..5a220af 100644 --- a/tests/testthat/test-as-flextable.R +++ b/tests/testthat/test-as-flextable.R @@ -1,25 +1,14 @@ x <- tibble::as_tibble(iris[c(1, 2, 51, 52), c(5, 1)]) -test_that("flextable.data.frame", { - expect_identical(flextable(x), flextable::flextable(x)) - expect_identical( - flextable(x, with_blanks("Species", "Sepal.Length")), - flextable::flextable( - x, - col_keys = c("Species", "..after1", "..before1", "Sepal.Length") - ) - ) -}) - - test_that("as.flextable.grouped_df", { + options(ftExtra.ignore.deprecation = TRUE) d <- dplyr::group_by(x, .data$Species) f <- flextable::as_grouped_data(x, "Species") - expect_identical(flextable(d), as_flextable(f)) + expect_identical(as_flextable(d), as_flextable(f)) expect_identical( - flextable(d, groups_to = "merged"), + as_flextable(d, groups_to = "merged"), x %>% flextable::flextable() %>% flextable::merge_v("Species") %>% @@ -27,17 +16,7 @@ test_that("as.flextable.grouped_df", { ) expect_identical( - flextable(d, groups_to = "merged", col_keys = with_blanks("Species")), - x %>% - flextable::flextable( - col_keys = c("Species", "..after1", "Sepal.Length") - ) %>% - flextable::merge_v("Species") %>% - flextable::theme_vanilla() - ) - - expect_identical( - flextable(d, groups_to = "asis"), + as_flextable(d, groups_to = "asis"), flextable::flextable(x) ) }) @@ -50,10 +29,10 @@ test_that("flextable.grouped_df multi groups", { dplyr::group_by(am, cyl, mpg) f <- flextable::as_grouped_data(x, groups = c("am", "cyl", "mpg")) - expect_identical(flextable(d), as_flextable(f)) + expect_identical(as_flextable(d), as_flextable(f)) expect_identical( - flextable(d, groups_to = "merged"), + as_flextable(d, groups_to = "merged"), x %>% dplyr::relocate(am, cyl, mpg) %>% flextable::flextable() %>% @@ -62,7 +41,7 @@ test_that("flextable.grouped_df multi groups", { ) expect_identical( - flextable(d, groups_to = "merged", groups_arrange = TRUE), + as_flextable(d, groups_to = "merged", groups_arrange = TRUE), x %>% dplyr::relocate(am, cyl, mpg) %>% dplyr::arrange(am, cyl, mpg) %>% @@ -72,7 +51,7 @@ test_that("flextable.grouped_df multi groups", { ) expect_identical( - flextable(d, groups_to = "merged", groups_pos = "asis"), + as_flextable(d, groups_to = "merged", groups_pos = "asis"), x %>% flextable::flextable() %>% flextable::merge_v(c("am", "cyl", "mpg")) %>% @@ -80,22 +59,7 @@ test_that("flextable.grouped_df multi groups", { ) expect_identical( - flextable( - d, - groups_to = "merged", - col_keys = with_blanks(tidyselect::starts_with("m")) - ), - x %>% - dplyr::relocate(am, cyl, mpg) %>% - flextable::flextable( - col_keys = c("am", "cyl", "mpg", "..after1", "model", "..after2", "disp") - ) %>% - flextable::merge_v(c("am", "cyl", "mpg")) %>% - flextable::theme_vanilla() - ) - - expect_identical( - flextable(d, groups_to = "asis"), + as_flextable(d, groups_to = "asis"), flextable::flextable(x) ) }) diff --git a/tests/testthat/test-header-transform.R b/tests/testthat/test-header-transform.R index 9c285e3..6f1f2d1 100644 --- a/tests/testthat/test-header-transform.R +++ b/tests/testthat/test-header-transform.R @@ -28,9 +28,9 @@ test_that("merge_header", { expect_identical(merge_header(ft, FALSE), ft) }) -test_that("separate-header", { +test_that("split-header", { expect_identical( - d %>% flextable() %>% separate_header(), + d %>% flextable() %>% split_header(), ft %>% flextable::theme_booktabs() %>% flextable::fix_border_issues() ) }) From 0dc03766b9c2a567a2f70b9e2402635d2d1361a7 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:19:01 +0900 Subject: [PATCH 07/10] docs(vignettes): use split_header instead of separate_header --- vignettes/transform-headers.Rmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vignettes/transform-headers.Rmd b/vignettes/transform-headers.Rmd index 2000f80..4ad2cf6 100644 --- a/vignettes/transform-headers.Rmd +++ b/vignettes/transform-headers.Rmd @@ -28,12 +28,12 @@ ft <- iris[1:2, ] %>% flextable ft ``` -# Separate headers +# Split headers -The `separate_header()` function generates multi-level headers by separating original headers (row names) by delimiters. +The `split_header()` function generates multi-level headers by separating original headers (row names) by delimiters. ```{r} -ft %>% separate_header() +ft %>% split_header() ``` The `sep` argument defines delimiters by regular expression. @@ -41,13 +41,13 @@ The default delimiters are `.` and `_`. Let's see what happens when `seop = "e"` ```{r} -ft %>% separate_header(sep = "e") +ft %>% split_header(sep = "e") ``` # Span headers The `span_header()` function also generates multi-level headers. -Unlike the `separate_header()` function, the `span_header()` function merges adjacent headers if they have same values. +Unlike the `split_header()` function, the `span_header()` function merges adjacent headers if they have same values. ```{r} ft %>% span_header() From adbba25201180b3ca5847d305d4f822b5cf118d8 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:23:19 +0900 Subject: [PATCH 08/10] docs(news): add items --- NEWS.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4a983a6..4ae5074 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# ftExtra 0.6.1 + +* Deprecated functions masking the corresponding ones from the **flextable** package (#95) + +* Renamed `separate_header` to `split_header` (#95) + +* Fixed a wrong escape regex in the `sep` parameter of `split_header`, `span_header`, and `separate_header` (#95) + # ftExtra 0.6.0 * Fix `footnote_options` not controlling reference symbols correctly. Formerly, only symbols in the cells used the `prefix` and the `suffix` arguments. Now, footnote texts also respects them (#88). From b86f8acc11fbf155e54175aa60fb1dd61eecdd16 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:10:49 +0900 Subject: [PATCH 09/10] docs(build): devtools::document(); pkgdown::build_site() --- NAMESPACE | 1 + docs/articles/format_columns.html | 244 +++++----- docs/articles/group-rows.html | 476 ++++++++++---------- docs/articles/transform-headers.html | 182 ++++---- docs/news/index.html | 10 +- docs/pkgdown.yml | 4 +- docs/reference/as_flextable_methods.html | 13 +- docs/reference/as_paragraph_md.html | 2 +- docs/reference/colformat_md.html | 2 +- docs/reference/footnote_options.html | 6 +- docs/reference/index.html | 8 +- docs/reference/reexports.html | 4 +- docs/reference/span_header.html | 10 +- docs/reference/split_header.html | 139 ++++++ docs/reference/with_blanks.html | 4 +- docs/sitemap.xml | 3 + man/footnote_options.Rd | 2 +- man/reexports.Rd | 3 +- man/span_header.Rd | 7 +- man/{separate_header.Rd => split_header.Rd} | 16 +- 20 files changed, 658 insertions(+), 478 deletions(-) create mode 100644 docs/reference/split_header.html rename man/{separate_header.Rd => split_header.Rd} (70%) diff --git a/NAMESPACE b/NAMESPACE index d635acf..bc9ccad 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,7 @@ export(flextable) export(footnote_options) export(separate_header) export(span_header) +export(split_header) export(with_blanks) importFrom(flextable,as_flextable) importFrom(flextable,flextable) diff --git a/docs/articles/format_columns.html b/docs/articles/format_columns.html index 5e4b61f..023b0be 100644 --- a/docs/articles/format_columns.html +++ b/docs/articles/format_columns.html @@ -135,12 +135,12 @@