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 @@

Why markdown?) )
- - - + +

Oxide

+ - - + +

Oxide

SiO2

Al2O3

SiO2

Al2O3

@@ -187,12 +187,12 @@

Why markdown?} ft
- - - + +

Oxide

+ - - + +

Oxide

SiO2

Fe2O3

SiO2

Fe2O3

@@ -204,8 +204,7 @@

Why markdown?
  • Preprocess a data frame to decorate texts with markdown syntax.
  • Convert the data frame into a flextable object with the -flextable function or as_flextable -function.
  • +flextable function or flextable function.
  • Format markdown columns with colformat_md
  • @@ -220,12 +219,12 @@

    Why markdown?flextable::flextable() %>% ftExtra::colformat_md()
    - - - + +

    Oxide

    + - - + +

    Oxide

    SiO2

    Fe2O3

    SiO2

    Fe2O3

    @@ -237,7 +236,7 @@

    Why markdown?
    -readr::read_csv("example.csv") %>%
    +readr::read_csv("example.csv") %>%
       flextable::flextable() %>%
       ftExtra::colformat_md()

    By default, the ftExtra package employs Pandoc’s @@ -261,29 +260,29 @@

    Basic examples ), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md()
    - - + +
    - - - - + + + + - - - - + + + + - - - - + + + +

    a

    b

    c

    d

    a

    b

    c

    d

    bold

    superscript

    code

    ftExtra is

    bold

    superscript

    code

    ftExtra is

    italic

    subscript

    underline

    Cool

    italic

    subscript

    underline

    Cool

    @@ -336,21 +335,21 @@

    Footnotes= "Extensions for 'Flextable'^[Supports of footnotes]", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.5)

    - - + +
    - - + + - - + + - +

    package

    description

    package

    description

    ftExtra

    Extensions for Flextable1

    ftExtra

    Extensions for Flextable1

    1Supports of footnotes

    1Supports of footnotes

    Reference symbols can be configured by @@ -362,7 +361,7 @@

    Footnotes= "Extensions for 'Flextable'^[Supports of footnotes]", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md( .footnote_options = footnote_options( ref = "i", @@ -375,17 +374,17 @@

    Footnotes) %>% flextable::autofit(add_w = 0.5)
    - - + +
    - - + + - - + + - +

    package

    description

    package

    description

    ftExtra[ii]

    Extensions for Flextable[iii]

    ftExtra[ii]

    Extensions for Flextable[iii]

    [ii]Short of flextable extra; [iii]Supports of footnotes;

    [ii]Short of flextable extra; [iii]Supports of footnotes;

    In order to add multiple footnotes to a cell, use normal footnotes @@ -400,16 +399,16 @@

    Footnotes[^b]: bbb", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md()
    - - - - + +

    x

    foo1, 2

    + + - - + +

    x

    foo1, 2

    1aaa

    2bbb

    1aaa

    2bbb

    @@ -445,7 +444,7 @@

    Footnotes"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) @@ -457,26 +456,26 @@

    Footnotes# tweak width for visibility flextable::autofit(add_w = 0.2)
    - - + +
    - - + + - - + + - - + + - - - + + +

    header1a

    header2

    header1a

    header2

    x1

    a

    x1

    a

    y

    b2

    y

    b2

    a: note a

    1: note 1

    2: note 2

    a: note a

    1: note 1

    2: note 2

    @@ -508,14 +507,14 @@

    Images R = sprintf("![](%s)", file.path(R.home("doc"), "html", "logo.jpg")), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit()
    - - - - + +

    R

    + +

    R

    The R logo is distributed by The R Foundation with the CC-BY-SA 4.0 @@ -527,39 +526,39 @@

    Line breaks
     data.frame(linebreak = c("a\nb"), stringsAsFactors = FALSE) %>%
    -  as_flextable() %>%
    +  flextable() %>%
       colformat_md()
    - - - - + +

    linebreak

    a b

    + +

    linebreak

    a b

    Pandoc’s markdown supports hard line breaks by adding a backslash or double spaces at the end of a line.

     data.frame(linebreak = c("a\\\nb"), stringsAsFactors = FALSE) %>%
    -  as_flextable() %>%
    +  flextable() %>%
       colformat_md()
    - - - - + +

    linebreak

    a
    b

    + +

    linebreak

    a
    b

    It is also possible to make \n as a hard line break by extending Pandoc’s Markdown.

     data.frame(linebreak = c("a\nb"), stringsAsFactors = FALSE) %>%
    -  as_flextable() %>%
    +  flextable() %>%
       colformat_md(md_extensions = "+hard_line_breaks")
    - - - - + +

    linebreak

    a
    b

    + +

    linebreak

    a
    b

    Markdown treats continuous linebreaks as a separator of blocks such @@ -569,13 +568,13 @@

    Line breaks
     data.frame(linebreak = c("a\n\nb"), stringsAsFactors = FALSE) %>%
    -  as_flextable() %>%
    +  flextable() %>%
       colformat_md(.sep = "\n\n")
    - - - - + +

    linebreak

    a

    b

    + +

    linebreak

    a

    b

    @@ -589,8 +588,9 @@

    Citations title = {ftExtra: Extensions for Flextable}, author = {Atsushi Yasumoto}, year = {2023}, - note = {https://ftextra.atusy.net}, -} + note = {R package version 0.6.0}, + url = {https://ftextra.atusy.net}, +}

    Second, specify it, and optionally a CSL file, within the YAML front matter.

    ---
    @@ -603,7 +603,7 @@ 

    Citations= c("@R-ftExtra", "[@R-ftExtra]", "[-@R-ftExtra]"), stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.2)

    - - - + +

    Cite

    + - - - + + +

    Cite

    Yasumoto (2023)

    (Yasumoto 2023)

    (2023)

    Yasumoto (2023)

    (Yasumoto 2023)

    (2023)

    @@ -636,14 +636,14 @@

    Math math = "$e^{i\\theta} = \\cos \\theta + i \\sin \\theta$", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md() %>% flextable::autofit(add_w = 0.2)
    - - - - + +

    math

    eiθ = cos θ + isin θ

    + +

    math

    eiθ = cos θ + isin θ

    Note that results can be insufficient. This feature relies on @@ -660,13 +660,13 @@

    Emoji md_extensions="+emoji".

     data.frame(emoji = c(":+1:"), stringsAsFactors = FALSE) %>%
    -  as_flextable() %>%
    +  flextable() %>%
       colformat_md(md_extensions = "+emoji")
    - - - - + +

    emoji

    👍

    + +

    emoji

    👍

    @@ -680,13 +680,13 @@

    Other input formats= "H<sub>2</sub>O", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md(.from = "html")
    - - - - + +

    x

    H2O

    + +

    x

    H2O

    Note that multiple paragraphs are not supported if .from @@ -696,13 +696,13 @@

    Other input formats= "foo\n\nbar", stringsAsFactors = FALSE ) %>% - as_flextable() %>% + flextable() %>% colformat_md(.from = "commonmark")
    - - - - + +

    x

    foobar

    + +

    x

    foobar

    diff --git a/docs/articles/group-rows.html b/docs/articles/group-rows.html index c6aec68..a2f1db4 100644 --- a/docs/articles/group-rows.html +++ b/docs/articles/group-rows.html @@ -119,53 +119,53 @@

    Single grouping columns
     grouped_iris %>% as_flextable()
    - - + +
    - - - - + + + + - + - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - + + + +

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Species: setosa

    Species: setosa

    5.1

    3.5

    1.4

    0.2

    5.1

    3.5

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    Species: versicolor

    Species: versicolor

    7.0

    3.2

    4.7

    1.4

    7.0

    3.2

    4.7

    1.4

    6.4

    3.2

    4.5

    1.5

    6.4

    3.2

    4.5

    1.5

    Species: virginica

    Species: virginica

    6.3

    3.3

    6.0

    2.5

    6.3

    3.3

    6.0

    2.5

    5.8

    2.7

    5.1

    1.9

    5.8

    2.7

    5.1

    1.9

    @@ -173,53 +173,53 @@

    Single grouping columns
     grouped_iris %>% as_flextable(hide_grouplabel = TRUE)

    - - + +
    - - - - + + + + - + - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - + + + +

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    setosa

    setosa

    5.1

    3.5

    1.4

    0.2

    5.1

    3.5

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    versicolor

    versicolor

    7.0

    3.2

    4.7

    1.4

    7.0

    3.2

    4.7

    1.4

    6.4

    3.2

    4.5

    1.5

    6.4

    3.2

    4.5

    1.5

    virginica

    virginica

    6.3

    3.3

    6.0

    2.5

    6.3

    3.3

    6.0

    2.5

    5.8

    2.7

    5.1

    1.9

    5.8

    2.7

    5.1

    1.9

    @@ -231,53 +231,53 @@

    Multiple grouping columns
     grouped_mtcars %>% as_flextable()

    - - + +
    - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + +

    model

    mpg

    disp

    model

    mpg

    disp

    am: 1.0

    cyl: 6.0

    am: 1.0

    cyl: 6.0

    Mazda RX4

    21.0

    160

    Mazda RX4

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    am: 1.0

    cyl: 4.0

    am: 1.0

    cyl: 4.0

    Datsun 710

    22.8

    108

    Datsun 710

    22.8

    108

    am: 0.0

    cyl: 6.0

    am: 0.0

    cyl: 6.0

    Hornet 4 Drive

    21.4

    258

    Hornet 4 Drive

    21.4

    258

    am: 0.0

    cyl: 8.0

    am: 0.0

    cyl: 8.0

    Hornet Sportabout

    18.7

    360

    Hornet Sportabout

    18.7

    360

    am: 0.0

    cyl: 6.0

    am: 0.0

    cyl: 6.0

    Valiant

    18.1

    225

    Valiant

    18.1

    225

    @@ -296,56 +296,59 @@

    Single grouping variable
     grouped_iris %>%
    -  as_flextable(groups_to = "merged")
    + as_flextable(groups_to = "merged") +#> Warning: 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)`

    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - + + + +

    Species

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Species

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    setosa

    5.1

    3.5

    1.4

    0.2

    setosa

    5.1

    3.5

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    4.9

    3.0

    1.4

    0.2

    versicolor

    7.0

    3.2

    4.7

    1.4

    versicolor

    7.0

    3.2

    4.7

    1.4

    6.4

    3.2

    4.5

    1.5

    6.4

    3.2

    4.5

    1.5

    virginica

    6.3

    3.3

    6.0

    2.5

    virginica

    6.3

    3.3

    6.0

    2.5

    5.8

    2.7

    5.1

    1.9

    5.8

    2.7

    5.1

    1.9

    @@ -356,107 +359,113 @@

    Multiple grouping variables
     grouped_mtcars %>%
    -  as_flextable(groups_to = "merged", groups_arrange = TRUE)

    + as_flextable(groups_to = "merged", groups_arrange = TRUE) +#> Warning: 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)`
    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - + + +

    am

    cyl

    model

    mpg

    disp

    am

    cyl

    model

    mpg

    disp

    0

    6

    Hornet 4 Drive

    21.4

    258

    0

    6

    Hornet 4 Drive

    21.4

    258

    Valiant

    18.1

    225

    Valiant

    18.1

    225

    8

    Hornet Sportabout

    18.7

    360

    8

    Hornet Sportabout

    18.7

    360

    1

    4

    Datsun 710

    22.8

    108

    1

    4

    Datsun 710

    22.8

    108

    6

    Mazda RX4

    21.0

    160

    6

    Mazda RX4

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

     grouped_mtcars %>%
    -  as_flextable(groups_to = "merged", groups_arrange = FALSE)
    + as_flextable(groups_to = "merged", groups_arrange = FALSE) +#> Warning: 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)`
    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - + + + +

    am

    cyl

    model

    mpg

    disp

    am

    cyl

    model

    mpg

    disp

    1

    6

    Mazda RX4

    21.0

    160

    1

    6

    Mazda RX4

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    4

    Datsun 710

    22.8

    108

    4

    Datsun 710

    22.8

    108

    0

    6

    Hornet 4 Drive

    21.4

    258

    0

    6

    Hornet 4 Drive

    21.4

    258

    8

    Hornet Sportabout

    18.7

    360

    8

    Hornet Sportabout

    18.7

    360

    6

    Valiant

    18.1

    225

    6

    Valiant

    18.1

    225

    @@ -470,54 +479,57 @@

    Position of grouping variables
     grouped_mtcars %>%
       as_flextable(groups_to = "merged", groups_pos = "asis") %>%
    -  flextable::theme_vanilla()

    + flextable::theme_vanilla() +#> Warning: 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)`
    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - + + + +

    model

    cyl

    mpg

    disp

    am

    model

    cyl

    mpg

    disp

    am

    Mazda RX4

    6

    21.0

    160

    1

    Mazda RX4

    6

    21.0

    160

    1

    Mazda RX4 Wag

    21.0

    160

    Mazda RX4 Wag

    21.0

    160

    Datsun 710

    4

    22.8

    108

    Datsun 710

    4

    22.8

    108

    Hornet 4 Drive

    6

    21.4

    258

    0

    Hornet 4 Drive

    6

    21.4

    258

    0

    Hornet Sportabout

    8

    18.7

    360

    Hornet Sportabout

    8

    18.7

    360

    Valiant

    6

    18.1

    225

    Valiant

    6

    18.1

    225

    diff --git a/docs/articles/transform-headers.html b/docs/articles/transform-headers.html index 21aa931..bbbc85f 100644 --- a/docs/articles/transform-headers.html +++ b/docs/articles/transform-headers.html @@ -105,77 +105,77 @@

    Create multi level headers

    Prepare flextable

    -ft <- iris[1:2, ] %>% as_flextable
    +ft <- iris[1:2, ] %>% flextable
     ft
    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Species

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Species

    5.1

    3.5

    1.4

    0.2

    setosa

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    -

    Separate headers +

    Split headers

    -

    The separate_header() function generates multi-level +

    The split_header() function generates multi-level headers by separating original headers (row names) by delimiters.

    +ft %>% split_header()
    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +

    Sepal

    Sepal

    Petal

    Petal

    Species

    Sepal

    Sepal

    Petal

    Petal

    Species

    Length

    Width

    Length

    Width

    Length

    Width

    Length

    Width

    5.1

    3.5

    1.4

    0.2

    setosa

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    @@ -184,47 +184,47 @@

    Separate headers. and _. Let’s see what happens when seop = "e"

    +ft %>% split_header(sep = "e")

    - - + +
    - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +

    S

    S

    P

    P

    Sp

    S

    S

    P

    P

    Sp

    pal.L

    pal.Width

    tal.L

    tal.Width

    ci

    pal.L

    pal.Width

    tal.L

    tal.Width

    ci

    ngth

    ngth

    s

    ngth

    ngth

    s

    5.1

    3.5

    1.4

    0.2

    setosa

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    @@ -234,41 +234,41 @@

    Separate headersSpan headers

    The span_header() function also generates multi-level -headers. Unlike the separate_header() function, the +headers. Unlike the split_header() function, the span_header() function merges adjacent headers if they have same values.

    - - + +
    - - - + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + +

    Sepal

    Petal

    Species

    Sepal

    Petal

    Species

    Length

    Width

    Length

    Width

    Length

    Width

    Length

    Width

    5.1

    3.5

    1.4

    0.2

    setosa

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    diff --git a/docs/news/index.html b/docs/news/index.html index 05463fa..93b731f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -64,7 +64,13 @@

    Changelog

    - + +
    • 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)

    • +
    +
    +
    • 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).

    • Support fine controls on footnote symbols in two ways. See ?footnote_options for the details (#90).

      @@ -185,7 +191,7 @@

      New features
      • Add colformat_md() which parses markdown text in the body of the flextable object.
      • -
      • Add separate_header() which separates header into multiple rows based on regular expression.
      • +
      • Add separate_header() which separates header into multiple rows based on regular expression.
      • Add span_header() which separates header into multiple rows based on regular expression, and spans them if the adjacent values share the same value.
      • Add with_blanks() which inserts blank columns based on the semantics of dplyr::select.
      • Add as_flextable.data.frame to convert data frames to flextable.
      • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index f57175b..2c67d72 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,9 +1,9 @@ -pandoc: 3.1.2 +pandoc: 3.1.8 pkgdown: 2.0.7 pkgdown_sha: ~ articles: format_columns: format_columns.html group-rows: group-rows.html transform-headers: transform-headers.html -last_built: 2023-05-29T00:50Z +last_built: 2023-09-19T23:56Z diff --git a/docs/reference/as_flextable_methods.html b/docs/reference/as_flextable_methods.html index b22c30c..a4fa7cd 100644 --- a/docs/reference/as_flextable_methods.html +++ b/docs/reference/as_flextable_methods.html @@ -150,14 +150,17 @@

        Examples

        dplyr::slice(1, 2) as_flextable(grouped_df, groups_to = "titles") -

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        Species: setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        Species: versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        Species: virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "titles", hide_grouplabel = TRUE) -

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "merged") -

        Species

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "asis") -

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        Species

        5.1

        3.5

        1.4

        0.2

        setosa

        4.9

        3.0

        1.4

        0.2

        setosa

        7.0

        3.2

        4.7

        1.4

        versicolor

        6.4

        3.2

        4.5

        1.5

        versicolor

        6.3

        3.3

        6.0

        2.5

        virginica

        5.8

        2.7

        5.1

        1.9

        virginica

        # For data.frame +

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        Species: setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        Species: versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        Species: virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "titles", hide_grouplabel = TRUE) +

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "merged") +#> Warning: 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)` +

        Species

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        setosa

        5.1

        3.5

        1.4

        0.2

        4.9

        3.0

        1.4

        0.2

        versicolor

        7.0

        3.2

        4.7

        1.4

        6.4

        3.2

        4.5

        1.5

        virginica

        6.3

        3.3

        6.0

        2.5

        5.8

        2.7

        5.1

        1.9

        as_flextable(grouped_df, groups_to = "asis") +#> Warning: 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)` +

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        Species

        5.1

        3.5

        1.4

        0.2

        setosa

        4.9

        3.0

        1.4

        0.2

        setosa

        7.0

        3.2

        4.7

        1.4

        versicolor

        6.4

        3.2

        4.5

        1.5

        versicolor

        6.3

        3.3

        6.0

        2.5

        virginica

        5.8

        2.7

        5.1

        1.9

        virginica

        # For data.frame iris %>% head() %>% as_flextable() -

        Sepal.Length

        Sepal.Width

        Petal.Length

        Petal.Width

        Species

        5.1

        3.5

        1.4

        0.2

        setosa

        4.9

        3.0

        1.4

        0.2

        setosa

        4.7

        3.2

        1.3

        0.2

        setosa

        4.6

        3.1

        1.5

        0.2

        setosa

        5.0

        3.6

        1.4

        0.2

        setosa

        5.4

        3.9

        1.7

        0.4

        setosa

    +#> Warning: 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)` +

    Sepal.Length

    Sepal.Width

    Petal.Length

    Petal.Width

    Species

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.7

    3.2

    1.3

    0.2

    setosa

    4.6

    3.1

    1.5

    0.2

    setosa

    5.0

    3.6

    1.4

    0.2

    setosa

    5.4

    3.9

    1.7

    0.4

    setosa

    +

    x

    foo bar

    baz

    *qux*

    +

    x

    y

    z

    bold

    superscript

    ftExtra is

    italic

    subscript

    Cool

    -
    span_header(x, sep = "[_\\.]", theme_fun = NULL, ...)
    +
    span_header(x, sep = "[_.]", theme_fun = NULL, ...)
    @@ -99,13 +99,17 @@

    Arguments

    Passed to theme_fun

    +
    +

    Note

    +

    split_header is a rename of separate_header and the latter will be removed in the future release.

    +

    Examples

    iris %>%
    -  as_flextable() %>%
    +  flextable() %>%
       span_header()
    -

    Sepal

    Petal

    Species

    Length

    Width

    Length

    Width

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.7

    3.2

    1.3

    0.2

    setosa

    4.6

    3.1

    1.5

    0.2

    setosa

    5.0

    3.6

    1.4

    0.2

    setosa

    5.4

    3.9

    1.7

    0.4

    setosa

    4.6

    3.4

    1.4

    0.3

    setosa

    5.0

    3.4

    1.5

    0.2

    setosa

    4.4

    2.9

    1.4

    0.2

    setosa

    4.9

    3.1

    1.5

    0.1

    setosa

    5.4

    3.7

    1.5

    0.2

    setosa

    4.8

    3.4

    1.6

    0.2

    setosa

    4.8

    3.0

    1.4

    0.1

    setosa

    4.3

    3.0

    1.1

    0.1

    setosa

    5.8

    4.0

    1.2

    0.2

    setosa

    5.7

    4.4

    1.5

    0.4

    setosa

    5.4

    3.9

    1.3

    0.4

    setosa

    5.1

    3.5

    1.4

    0.3

    setosa

    5.7

    3.8

    1.7

    0.3

    setosa

    5.1

    3.8

    1.5

    0.3

    setosa

    5.4

    3.4

    1.7

    0.2

    setosa

    5.1

    3.7

    1.5

    0.4

    setosa

    4.6

    3.6

    1.0

    0.2

    setosa

    5.1

    3.3

    1.7

    0.5

    setosa

    4.8

    3.4

    1.9

    0.2

    setosa

    5.0

    3.0

    1.6

    0.2

    setosa

    5.0

    3.4

    1.6

    0.4

    setosa

    5.2

    3.5

    1.5

    0.2

    setosa

    5.2

    3.4

    1.4

    0.2

    setosa

    4.7

    3.2

    1.6

    0.2

    setosa

    4.8

    3.1

    1.6

    0.2

    setosa

    5.4

    3.4

    1.5

    0.4

    setosa

    5.2

    4.1

    1.5

    0.1

    setosa

    5.5

    4.2

    1.4

    0.2

    setosa

    4.9

    3.1

    1.5

    0.2

    setosa

    5.0

    3.2

    1.2

    0.2

    setosa

    5.5

    3.5

    1.3

    0.2

    setosa

    4.9

    3.6

    1.4

    0.1

    setosa

    4.4

    3.0

    1.3

    0.2

    setosa

    5.1

    3.4

    1.5

    0.2

    setosa

    5.0

    3.5

    1.3

    0.3

    setosa

    4.5

    2.3

    1.3

    0.3

    setosa

    4.4

    3.2

    1.3

    0.2

    setosa

    5.0

    3.5

    1.6

    0.6

    setosa

    5.1

    3.8

    1.9

    0.4

    setosa

    4.8

    3.0

    1.4

    0.3

    setosa

    5.1

    3.8

    1.6

    0.2

    setosa

    4.6

    3.2

    1.4

    0.2

    setosa

    5.3

    3.7

    1.5

    0.2

    setosa

    5.0

    3.3

    1.4

    0.2

    setosa

    7.0

    3.2

    4.7

    1.4

    versicolor

    6.4

    3.2

    4.5

    1.5

    versicolor

    6.9

    3.1

    4.9

    1.5

    versicolor

    5.5

    2.3

    4.0

    1.3

    versicolor

    6.5

    2.8

    4.6

    1.5

    versicolor

    5.7

    2.8

    4.5

    1.3

    versicolor

    6.3

    3.3

    4.7

    1.6

    versicolor

    4.9

    2.4

    3.3

    1.0

    versicolor

    6.6

    2.9

    4.6

    1.3

    versicolor

    5.2

    2.7

    3.9

    1.4

    versicolor

    5.0

    2.0

    3.5

    1.0

    versicolor

    5.9

    3.0

    4.2

    1.5

    versicolor

    6.0

    2.2

    4.0

    1.0

    versicolor

    6.1

    2.9

    4.7

    1.4

    versicolor

    5.6

    2.9

    3.6

    1.3

    versicolor

    6.7

    3.1

    4.4

    1.4

    versicolor

    5.6

    3.0

    4.5

    1.5

    versicolor

    5.8

    2.7

    4.1

    1.0

    versicolor

    6.2

    2.2

    4.5

    1.5

    versicolor

    5.6

    2.5

    3.9

    1.1

    versicolor

    5.9

    3.2

    4.8

    1.8

    versicolor

    6.1

    2.8

    4.0

    1.3

    versicolor

    6.3

    2.5

    4.9

    1.5

    versicolor

    6.1

    2.8

    4.7

    1.2

    versicolor

    6.4

    2.9

    4.3

    1.3

    versicolor

    6.6

    3.0

    4.4

    1.4

    versicolor

    6.8

    2.8

    4.8

    1.4

    versicolor

    6.7

    3.0

    5.0

    1.7

    versicolor

    6.0

    2.9

    4.5

    1.5

    versicolor

    5.7

    2.6

    3.5

    1.0

    versicolor

    5.5

    2.4

    3.8

    1.1

    versicolor

    5.5

    2.4

    3.7

    1.0

    versicolor

    5.8

    2.7

    3.9

    1.2

    versicolor

    6.0

    2.7

    5.1

    1.6

    versicolor

    5.4

    3.0

    4.5

    1.5

    versicolor

    6.0

    3.4

    4.5

    1.6

    versicolor

    6.7

    3.1

    4.7

    1.5

    versicolor

    6.3

    2.3

    4.4

    1.3

    versicolor

    5.6

    3.0

    4.1

    1.3

    versicolor

    5.5

    2.5

    4.0

    1.3

    versicolor

    5.5

    2.6

    4.4

    1.2

    versicolor

    6.1

    3.0

    4.6

    1.4

    versicolor

    5.8

    2.6

    4.0

    1.2

    versicolor

    5.0

    2.3

    3.3

    1.0

    versicolor

    5.6

    2.7

    4.2

    1.3

    versicolor

    5.7

    3.0

    4.2

    1.2

    versicolor

    5.7

    2.9

    4.2

    1.3

    versicolor

    6.2

    2.9

    4.3

    1.3

    versicolor

    5.1

    2.5

    3.0

    1.1

    versicolor

    5.7

    2.8

    4.1

    1.3

    versicolor

    6.3

    3.3

    6.0

    2.5

    virginica

    5.8

    2.7

    5.1

    1.9

    virginica

    7.1

    3.0

    5.9

    2.1

    virginica

    6.3

    2.9

    5.6

    1.8

    virginica

    6.5

    3.0

    5.8

    2.2

    virginica

    7.6

    3.0

    6.6

    2.1

    virginica

    4.9

    2.5

    4.5

    1.7

    virginica

    7.3

    2.9

    6.3

    1.8

    virginica

    6.7

    2.5

    5.8

    1.8

    virginica

    7.2

    3.6

    6.1

    2.5

    virginica

    6.5

    3.2

    5.1

    2.0

    virginica

    6.4

    2.7

    5.3

    1.9

    virginica

    6.8

    3.0

    5.5

    2.1

    virginica

    5.7

    2.5

    5.0

    2.0

    virginica

    5.8

    2.8

    5.1

    2.4

    virginica

    6.4

    3.2

    5.3

    2.3

    virginica

    6.5

    3.0

    5.5

    1.8

    virginica

    7.7

    3.8

    6.7

    2.2

    virginica

    7.7

    2.6

    6.9

    2.3

    virginica

    6.0

    2.2

    5.0

    1.5

    virginica

    6.9

    3.2

    5.7

    2.3

    virginica

    5.6

    2.8

    4.9

    2.0

    virginica

    7.7

    2.8

    6.7

    2.0

    virginica

    6.3

    2.7

    4.9

    1.8

    virginica

    6.7

    3.3

    5.7

    2.1

    virginica

    7.2

    3.2

    6.0

    1.8

    virginica

    6.2

    2.8

    4.8

    1.8

    virginica

    6.1

    3.0

    4.9

    1.8

    virginica

    6.4

    2.8

    5.6

    2.1

    virginica

    7.2

    3.0

    5.8

    1.6

    virginica

    7.4

    2.8

    6.1

    1.9

    virginica

    7.9

    3.8

    6.4

    2.0

    virginica

    6.4

    2.8

    5.6

    2.2

    virginica

    6.3

    2.8

    5.1

    1.5

    virginica

    6.1

    2.6

    5.6

    1.4

    virginica

    7.7

    3.0

    6.1

    2.3

    virginica

    6.3

    3.4

    5.6

    2.4

    virginica

    6.4

    3.1

    5.5

    1.8

    virginica

    6.0

    3.0

    4.8

    1.8

    virginica

    6.9

    3.1

    5.4

    2.1

    virginica

    6.7

    3.1

    5.6

    2.4

    virginica

    6.9

    3.1

    5.1

    2.3

    virginica

    5.8

    2.7

    5.1

    1.9

    virginica

    6.8

    3.2

    5.9

    2.3

    virginica

    6.7

    3.3

    5.7

    2.5

    virginica

    6.7

    3.0

    5.2

    2.3

    virginica

    6.3

    2.5

    5.0

    1.9

    virginica

    6.5

    3.0

    5.2

    2.0

    virginica

    6.2

    3.4

    5.4

    2.3

    virginica

    5.9

    3.0

    5.1

    1.8

    virginica

    +

    Sepal

    Petal

    Species

    Length

    Width

    Length

    Width

    5.1

    3.5

    1.4

    0.2

    setosa

    4.9

    3.0

    1.4

    0.2

    setosa

    4.7

    3.2

    1.3

    0.2

    setosa

    4.6

    3.1

    1.5

    0.2

    setosa

    5.0

    3.6

    1.4

    0.2

    setosa

    5.4

    3.9

    1.7

    0.4

    setosa

    4.6

    3.4

    1.4

    0.3

    setosa

    5.0

    3.4

    1.5

    0.2

    setosa

    4.4

    2.9

    1.4

    0.2

    setosa

    4.9

    3.1

    1.5

    0.1

    setosa

    5.4

    3.7

    1.5

    0.2

    setosa

    4.8

    3.4

    1.6

    0.2

    setosa

    4.8

    3.0

    1.4

    0.1

    setosa

    4.3

    3.0

    1.1

    0.1

    setosa

    5.8

    4.0

    1.2

    0.2

    setosa

    5.7

    4.4

    1.5

    0.4

    setosa

    5.4

    3.9

    1.3

    0.4

    setosa

    5.1

    3.5

    1.4

    0.3

    setosa

    5.7

    3.8

    1.7

    0.3

    setosa

    5.1

    3.8

    1.5

    0.3

    setosa

    5.4

    3.4

    1.7

    0.2

    setosa

    5.1

    3.7

    1.5

    0.4

    setosa

    4.6

    3.6

    1.0

    0.2

    setosa

    5.1

    3.3

    1.7

    0.5

    setosa

    4.8

    3.4

    1.9

    0.2

    setosa

    5.0

    3.0

    1.6

    0.2

    setosa

    5.0

    3.4

    1.6

    0.4

    setosa

    5.2

    3.5

    1.5

    0.2

    setosa

    5.2

    3.4

    1.4

    0.2

    setosa

    4.7

    3.2

    1.6

    0.2

    setosa

    4.8

    3.1

    1.6

    0.2

    setosa

    5.4

    3.4

    1.5

    0.4

    setosa

    5.2

    4.1

    1.5

    0.1

    setosa

    5.5

    4.2

    1.4

    0.2

    setosa

    4.9

    3.1

    1.5

    0.2

    setosa

    5.0

    3.2

    1.2

    0.2

    setosa

    5.5

    3.5

    1.3

    0.2

    setosa

    4.9

    3.6

    1.4

    0.1

    setosa

    4.4

    3.0

    1.3

    0.2

    setosa

    5.1

    3.4

    1.5

    0.2

    setosa

    5.0

    3.5

    1.3

    0.3

    setosa

    4.5

    2.3

    1.3

    0.3

    setosa

    4.4

    3.2

    1.3

    0.2

    setosa

    5.0

    3.5

    1.6

    0.6

    setosa

    5.1

    3.8

    1.9

    0.4

    setosa

    4.8

    3.0

    1.4

    0.3

    setosa

    5.1

    3.8

    1.6

    0.2

    setosa

    4.6

    3.2

    1.4

    0.2

    setosa

    5.3

    3.7

    1.5

    0.2

    setosa

    5.0

    3.3

    1.4

    0.2

    setosa

    7.0

    3.2

    4.7

    1.4

    versicolor

    6.4

    3.2

    4.5

    1.5

    versicolor

    6.9

    3.1

    4.9

    1.5

    versicolor

    5.5

    2.3

    4.0

    1.3

    versicolor

    6.5

    2.8

    4.6

    1.5

    versicolor

    5.7

    2.8

    4.5

    1.3

    versicolor

    6.3

    3.3

    4.7

    1.6

    versicolor

    4.9

    2.4

    3.3

    1.0

    versicolor

    6.6

    2.9

    4.6

    1.3

    versicolor

    5.2

    2.7

    3.9

    1.4

    versicolor

    5.0

    2.0

    3.5

    1.0

    versicolor

    5.9

    3.0

    4.2

    1.5

    versicolor

    6.0

    2.2

    4.0

    1.0

    versicolor

    6.1

    2.9

    4.7

    1.4

    versicolor

    5.6

    2.9

    3.6

    1.3

    versicolor

    6.7

    3.1

    4.4

    1.4

    versicolor

    5.6

    3.0

    4.5

    1.5

    versicolor

    5.8

    2.7

    4.1

    1.0

    versicolor

    6.2

    2.2

    4.5

    1.5

    versicolor

    5.6

    2.5

    3.9

    1.1

    versicolor

    5.9

    3.2

    4.8

    1.8

    versicolor

    6.1

    2.8

    4.0

    1.3

    versicolor

    6.3

    2.5

    4.9

    1.5

    versicolor

    6.1

    2.8

    4.7

    1.2

    versicolor

    6.4

    2.9

    4.3

    1.3

    versicolor

    6.6

    3.0

    4.4

    1.4

    versicolor

    6.8

    2.8

    4.8

    1.4

    versicolor

    6.7

    3.0

    5.0

    1.7

    versicolor

    6.0

    2.9

    4.5

    1.5

    versicolor

    5.7

    2.6

    3.5

    1.0

    versicolor

    5.5

    2.4

    3.8

    1.1

    versicolor

    5.5

    2.4

    3.7

    1.0

    versicolor

    5.8

    2.7

    3.9

    1.2

    versicolor

    6.0

    2.7

    5.1

    1.6

    versicolor

    5.4

    3.0

    4.5

    1.5

    versicolor

    6.0

    3.4

    4.5

    1.6

    versicolor

    6.7

    3.1

    4.7

    1.5

    versicolor

    6.3

    2.3

    4.4

    1.3

    versicolor

    5.6

    3.0

    4.1

    1.3

    versicolor

    5.5

    2.5

    4.0

    1.3

    versicolor

    5.5

    2.6

    4.4

    1.2

    versicolor

    6.1

    3.0

    4.6

    1.4

    versicolor

    5.8

    2.6

    4.0

    1.2

    versicolor

    5.0

    2.3

    3.3

    1.0

    versicolor

    5.6

    2.7

    4.2

    1.3

    versicolor

    5.7

    3.0

    4.2

    1.2

    versicolor

    5.7

    2.9

    4.2

    1.3

    versicolor

    6.2

    2.9

    4.3

    1.3

    versicolor

    5.1

    2.5

    3.0

    1.1

    versicolor

    5.7

    2.8

    4.1

    1.3

    versicolor

    6.3

    3.3

    6.0

    2.5

    virginica

    5.8

    2.7

    5.1

    1.9

    virginica

    7.1

    3.0

    5.9

    2.1

    virginica

    6.3

    2.9

    5.6

    1.8

    virginica

    6.5

    3.0

    5.8

    2.2

    virginica

    7.6

    3.0

    6.6

    2.1

    virginica

    4.9

    2.5

    4.5

    1.7

    virginica

    7.3

    2.9

    6.3

    1.8

    virginica

    6.7

    2.5

    5.8

    1.8

    virginica

    7.2

    3.6

    6.1

    2.5

    virginica

    6.5

    3.2

    5.1

    2.0

    virginica

    6.4

    2.7

    5.3

    1.9

    virginica

    6.8

    3.0

    5.5

    2.1

    virginica

    5.7

    2.5

    5.0

    2.0

    virginica

    5.8

    2.8

    5.1

    2.4

    virginica

    6.4

    3.2

    5.3

    2.3

    virginica

    6.5

    3.0

    5.5

    1.8

    virginica

    7.7

    3.8

    6.7

    2.2

    virginica

    7.7

    2.6

    6.9

    2.3

    virginica

    6.0

    2.2

    5.0

    1.5

    virginica

    6.9

    3.2

    5.7

    2.3

    virginica

    5.6

    2.8

    4.9

    2.0

    virginica

    7.7

    2.8

    6.7

    2.0

    virginica

    6.3

    2.7

    4.9

    1.8

    virginica

    6.7

    3.3

    5.7

    2.1

    virginica

    7.2

    3.2

    6.0

    1.8

    virginica

    6.2

    2.8

    4.8

    1.8

    virginica

    6.1

    3.0

    4.9

    1.8

    virginica

    6.4

    2.8

    5.6

    2.1

    virginica

    7.2

    3.0

    5.8

    1.6

    virginica

    7.4

    2.8

    6.1

    1.9

    virginica

    7.9

    3.8

    6.4

    2.0

    virginica

    6.4

    2.8

    5.6

    2.2

    virginica

    6.3

    2.8

    5.1

    1.5

    virginica

    6.1

    2.6

    5.6

    1.4

    virginica

    7.7

    3.0

    6.1

    2.3

    virginica

    6.3

    3.4

    5.6

    2.4

    virginica

    6.4

    3.1

    5.5

    1.8

    virginica

    6.0

    3.0

    4.8

    1.8

    virginica

    6.9

    3.1

    5.4

    2.1

    virginica

    6.7

    3.1

    5.6

    2.4

    virginica

    6.9

    3.1

    5.1

    2.3

    virginica

    5.8

    2.7

    5.1

    1.9

    virginica

    6.8

    3.2

    5.9

    2.3

    virginica

    6.7

    3.3

    5.7

    2.5

    virginica

    6.7

    3.0

    5.2

    2.3

    virginica

    6.3

    2.5

    5.0

    1.9

    virginica

    6.5

    3.0

    5.2

    2.0

    virginica

    6.2

    3.4

    5.4

    2.3

    virginica

    5.9

    3.0

    5.1

    1.8

    virginica