Closed phargarten2 closed 9 months ago
For that, you can play with delete_rows()
and maybe flextable_dim(ft)
that return the whole width and height or dim(ft)
that return the widths and the heights.
library(flextable)
x <- iris
rownum <- seq_len(nrow(x))
z <- flextable(x) |> autofit()
z1 <- delete_rows(z, i = setdiff(rownum, 1L:40L))
flextable_dim(z1)$heights
z2 <- delete_rows(z, i = setdiff(rownum, 41:80))
flextable_dim(z2)$heights
z3 <- delete_rows(z, i = setdiff(rownum, 81:120))
z4 <- delete_rows(z, i = setdiff(rownum, 121:150))
Thank you, David! The inclusion of delete_rows()
is a great addition to v. 0.9.4. Even better, I can use the row selectors to delete the rows not needed as well, which totally answers the question.
library(flextable)
x <- iris
rownum <- seq_len(nrow(x))
z <- flextable(x) |> autofit()
delete_rows(ft, ~ Species == "setosa", part = "body")
delete_rows(ft, ~ Species == "versicolor", part = "body")
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
Thank you for creating the flextable package. I find it great to use in reports and presentations. Situations arise where a flextable that works in a report does not work on a slide because the table is too big. Consider this example:
This table would be fine for a report, but on a slide it is way too big. I would need to split it on different slides.
Is there a way to split up the flextable (ft), say by Species? Or even specify that I would want the first 8 rows one slide and the last 8 rows on the next? Or, according to #95, I would need to do all this in the dataset, like iris, before producing a flextable.
=============================================================================== Not a bug or feature request? If you are looking for help using the package correctly, please read the doc first at https://davidgohel.github.io/flextable/. You can also visit Stackoverflow and tag your question with
[flextable]
. We usually read them and answer WHEN possible.