Create pretty tables for 'HTML', 'PDF', 'Microsoft Word' and 'Microsoft PowerPoint' documents from 'R Markdown'. Functions are provided to let users create tables, modify and format their content. It also extends package 'officer' that does not contain any feature for customized tabular reporting.
The flextable package provides a framework for easily create tables for reporting. Tables can be embedded within:
An API is available to let R users create tables for reporting and
control their formatting properties and their layout. A flextable
object is a data.frame representation, it can be manipulated with
functions that give control over:
There are articles on the flextable website that will help you get you to start quickly:
The help pages can be read here.
install.packages("flextable")
You can get the development version from GitHub:
devtools::install_github("davidgohel/flextable")
The help pages are located at https://davidgohel.github.io/flextable/.
This project is developped and maintained on my own time. If you have
questions about how to use the package, visit Stackoverflow and use tags
flextable
and r
Stackoverflow
link! I
usually read them and answer when possible.
Anyone getting involved in this package agrees to our Code of Conduct.
When you file a bug report, please spend some time making it easy for me to follow and reproduce. The more time you spend on making the bug report coherent, the more time I can dedicate to investigate the bug as opposed to the bug report.
A great way to start is to contribute an example or improve the documentation.
If you want to submit a Pull Request to integrate functions of yours, please provide:
tests/testthat
.By using rhub (run rhub::check_for_cran()
), you will see if everything
is ok. When submitted, the PR will be evaluated automatically on travis
and appveyor and you will be able to see if something broke.
theme_alafoli()
and theme_vader()
align_text_col()
and align_nottext_col()
to align
columns by data typemerge_h_range()
to merge a set of columns row by rowfix_border_issues()
fix issues with borders when cells are mergedadd_header_row()
, add_footer_row()
, add_header_lines()
and add_footer_lines()
to add easily data in header or footer.as_flextable()
to let develop new flextable functionsas_grouped_data()
and its method as_flextable()
to
create row titles to separate data in a flextable.values
for functions set_header_labels
and set_formatter
compose
that will replace display
set_caption
only available for html outputknit_print()
can be used with rmarkdown when rendering to PowerPoint.regulartable
and logical columnsbody_replace_flextable_at_bkm
to
replace a bookmarked paragraph by a flextable.colformat_*
to make content formatting easier.
It also deals with NA.format.flextable
method so that users can create
their components.ft.align
to align tables in
rmarkdown::word_document
and ft.split
to activate Word
option 'Allow row to break across pages'.display()
vline()
\n
is now supported. Function autofit
and dim_pretty
do not
support soft returns and may return wrong results (\n will be considered as "").border_outer()
hyperlink_text()
to be used with display
, font()
hline*()
and vline*()
and many new helper functions
to be used instead of borders.xtable_to_flextable()
that is returning
a flextable from an xtable object.htmltools_value()
is exported for shiny applications.knit_print()
to render flextable in rmarkdown.regulartable
, faster and simpler than flextable
ph_with_flextable_at
to add a flextable at any position in a slide.merge_at
is providing a general way of merging cells.theme_box()