flextable/0000755000176200001440000000000014615774006012232 5ustar liggesusersflextable/NAMESPACE0000644000176200001440000002306714600627416013455 0ustar liggesusers# Generated by roxygen2: do not edit by hand S3method(as_flextable,brmsfit) S3method(as_flextable,data.frame) S3method(as_flextable,gam) S3method(as_flextable,glm) S3method(as_flextable,glmmTMB) S3method(as_flextable,glmmadmb) S3method(as_flextable,gls) S3method(as_flextable,grouped_data) S3method(as_flextable,htest) S3method(as_flextable,kmeans) S3method(as_flextable,lm) S3method(as_flextable,lme) S3method(as_flextable,merMod) S3method(as_flextable,nlme) S3method(as_flextable,pam) S3method(as_flextable,summarizor) S3method(as_flextable,table) S3method(as_flextable,tabular) S3method(as_flextable,tabulator) S3method(as_flextable,xtable) S3method(dim,flextable) S3method(dim,flextableGrob) S3method(drawDetails,flextableHighlightedGrob) S3method(drawDetails,flextableRowPartGrob) S3method(format_fun,Date) S3method(format_fun,POSIXt) S3method(format_fun,character) S3method(format_fun,default) S3method(format_fun,double) S3method(format_fun,factor) S3method(format_fun,integer) S3method(format_fun,logical) S3method(format_fun,pct) S3method(knit_print,flextable) S3method(knit_print,run_reference) S3method(latex_container_str,latex_container_float) S3method(latex_container_str,latex_container_none) S3method(latex_container_str,latex_container_wrap) S3method(makeContext,flextableGrob) S3method(ph_with,flextable) S3method(plot,flextable) S3method(plot,flextableGrob) S3method(print,flextable) S3method(print,flextable_defaults) S3method(print,tabulator) S3method(rtf_add,flextable) S3method(summary,tabulator) S3method(to_html,flextable) S3method(to_rtf,flextable) S3method(to_wml,flextable) export(add_body) export(add_body_row) export(add_footer) export(add_footer_lines) export(add_footer_row) export(add_header) export(add_header_lines) export(add_header_row) export(add_latex_dep) export(align) export(align_nottext_col) export(align_text_col) export(append_chunks) export(as_b) export(as_bracket) export(as_chunk) export(as_equation) export(as_flextable) export(as_grouped_data) export(as_highlight) export(as_i) export(as_image) export(as_paragraph) export(as_raster) export(as_sub) export(as_sup) export(as_word_field) export(autofit) export(before) export(bg) export(body_add_flextable) export(body_replace_flextable_at_bkm) export(bold) export(border) export(border_inner) export(border_inner_h) export(border_inner_v) export(border_outer) export(border_remove) export(chunk_dataframe) export(colformat_char) export(colformat_date) export(colformat_datetime) export(colformat_double) export(colformat_image) export(colformat_int) export(colformat_lgl) export(colformat_num) export(color) export(colorize) export(compose) export(continuous_summary) export(delete_columns) export(delete_part) export(delete_rows) export(df_printer) export(dim_pretty) export(empty_blanks) export(fit_to_width) export(fix_border_issues) export(flextable) export(flextable_dim) export(flextable_html_dependency) export(flextable_to_rmd) export(fmt_2stats) export(fmt_avg_dev) export(fmt_dbl) export(fmt_header_n) export(fmt_int) export(fmt_n_percent) export(fmt_pct) export(fmt_signif_after_zeros) export(fmt_summarizor) export(font) export(fontsize) export(footers_flextable_at_bkm) export(footnote) export(fp_border_default) export(fp_text_default) export(gen_grob) export(get_flextable_defaults) export(gg_chunk) export(grid_chunk) export(headers_flextable_at_bkm) export(height) export(height_all) export(highlight) export(hline) export(hline_bottom) export(hline_top) export(hrule) export(htmltools_value) export(hyperlink_text) export(information_data_cell) export(information_data_chunk) export(information_data_paragraph) export(init_flextable_defaults) export(italic) export(keep_with_next) export(labelizor) export(line_spacing) export(linerange) export(lollipop) export(merge_at) export(merge_h) export(merge_h_range) export(merge_none) export(merge_v) export(minibar) export(mk_par) export(ncol_keys) export(nrow_part) export(padding) export(paginate) export(plot_chunk) export(prepend_chunks) export(proc_freq) export(qflextable) export(regulartable) export(rotate) export(save_as_docx) export(save_as_html) export(save_as_image) export(save_as_pptx) export(save_as_rtf) export(separate_header) export(set_caption) export(set_flextable_defaults) export(set_footer_df) export(set_formatter) export(set_formatter_type) export(set_header_df) export(set_header_labels) export(set_table_properties) export(shift_table) export(style) export(summarizor) export(surround) export(tab_settings) export(tabulator) export(tabulator_colnames) export(theme_alafoli) export(theme_apa) export(theme_booktabs) export(theme_box) export(theme_tron) export(theme_tron_legacy) export(theme_vader) export(theme_vanilla) export(theme_zebra) export(use_df_printer) export(use_model_printer) export(valign) export(vline) export(vline_left) export(vline_right) export(void) export(width) import(data.table) importFrom(data.table,":=") importFrom(data.table,.GRP) importFrom(data.table,.N) importFrom(data.table,.SD) importFrom(data.table,as.data.table) importFrom(data.table,data.table) importFrom(data.table,dcast) importFrom(data.table,fcase) importFrom(data.table,fifelse) importFrom(data.table,first) importFrom(data.table,fsetdiff) importFrom(data.table,groupingsets) importFrom(data.table,is.data.table) importFrom(data.table,rbindlist) importFrom(data.table,rleid) importFrom(data.table,rleidv) importFrom(data.table,setDF) importFrom(data.table,setDT) importFrom(data.table,setcolorder) importFrom(data.table,setkeyv) importFrom(data.table,setnames) importFrom(data.table,setorderv) importFrom(data.table,shift) importFrom(data.table,tstrsplit) importFrom(gdtools,installed_gfonts) importFrom(gdtools,m_str_extents) importFrom(gdtools,str_metrics) importFrom(grDevices,as.raster) importFrom(grDevices,col2rgb) importFrom(grDevices,dev.off) importFrom(grDevices,is.raster) importFrom(grDevices,rgb) importFrom(graphics,boxplot) importFrom(graphics,par) importFrom(graphics,plot) importFrom(grid,convertHeight) importFrom(grid,convertWidth) importFrom(grid,drawDetails) importFrom(grid,gList) importFrom(grid,gTree) importFrom(grid,gpar) importFrom(grid,grid.draw) importFrom(grid,grid.layout) importFrom(grid,grid.newpage) importFrom(grid,grid.rect) importFrom(grid,grobDescent) importFrom(grid,grobHeight) importFrom(grid,grobWidth) importFrom(grid,is.grob) importFrom(grid,makeContext) importFrom(grid,popViewport) importFrom(grid,pushViewport) importFrom(grid,rasterGrob) importFrom(grid,rectGrob) importFrom(grid,segmentsGrob) importFrom(grid,setChildren) importFrom(grid,textGrob) importFrom(grid,unit) importFrom(grid,viewport) importFrom(grid,vpStack) importFrom(htmltools,HTML) importFrom(htmltools,attachDependencies) importFrom(htmltools,browsable) importFrom(htmltools,div) importFrom(htmltools,htmlDependency) importFrom(htmltools,htmlEscape) importFrom(htmltools,save_html) importFrom(htmltools,tagList) importFrom(htmltools,tags) importFrom(knitr,asis_output) importFrom(knitr,fig_path) importFrom(knitr,include_graphics) importFrom(knitr,is_html_output) importFrom(knitr,is_latex_output) importFrom(knitr,knit_child) importFrom(knitr,knit_meta_add) importFrom(knitr,knit_print) importFrom(knitr,opts_current) importFrom(knitr,opts_knit) importFrom(knitr,pandoc_to) importFrom(knitr,raw_block) importFrom(knitr,raw_html) importFrom(knitr,raw_latex) importFrom(officer,add_slide) importFrom(officer,body_add_par) importFrom(officer,body_add_xml) importFrom(officer,body_set_default_section) importFrom(officer,cursor_bookmark) importFrom(officer,fp_border) importFrom(officer,fp_cell) importFrom(officer,fp_par) importFrom(officer,fp_tab) importFrom(officer,fp_tabs) importFrom(officer,fp_text) importFrom(officer,fp_text_lite) importFrom(officer,fpar) importFrom(officer,ftext) importFrom(officer,image_to_base64) importFrom(officer,officer_url_encode) importFrom(officer,opts_current_table) importFrom(officer,page_mar) importFrom(officer,page_size) importFrom(officer,ph_location_type) importFrom(officer,ph_with) importFrom(officer,prop_section) importFrom(officer,prop_table) importFrom(officer,read_docx) importFrom(officer,read_pptx) importFrom(officer,rtf_add) importFrom(officer,rtf_doc) importFrom(officer,run_autonum) importFrom(officer,run_bookmark) importFrom(officer,str_encode_to_rtf) importFrom(officer,table_colwidths) importFrom(officer,table_layout) importFrom(officer,table_width) importFrom(officer,to_html) importFrom(officer,to_rtf) importFrom(officer,to_wml) importFrom(ragg,agg_png) importFrom(rlang,call_args) importFrom(rlang,enquo) importFrom(rlang,enquos) importFrom(rlang,eval_tidy) importFrom(rlang,get_expr) importFrom(rlang,new_function) importFrom(rlang,pairlist2) importFrom(rlang,quo) importFrom(rlang,quo_name) importFrom(rlang,quo_text) importFrom(rlang,sym) importFrom(rmarkdown,html_document) importFrom(rmarkdown,latex_dependency) importFrom(rmarkdown,pandoc_available) importFrom(rmarkdown,pandoc_version) importFrom(rmarkdown,pdf_document) importFrom(rmarkdown,render) importFrom(stats,AIC) importFrom(stats,BIC) importFrom(stats,IQR) importFrom(stats,approx) importFrom(stats,as.formula) importFrom(stats,density) importFrom(stats,df.residual) importFrom(stats,logLik) importFrom(stats,mad) importFrom(stats,median) importFrom(stats,na.omit) importFrom(stats,naprint) importFrom(stats,nobs) importFrom(stats,quantile) importFrom(stats,reshape) importFrom(stats,runif) importFrom(stats,sd) importFrom(stats,setNames) importFrom(stats,terms) importFrom(stats,update) importFrom(utils,browseURL) importFrom(utils,compareVersion) importFrom(utils,getFromNamespace) importFrom(utils,head) importFrom(utils,modifyList) importFrom(utils,packageVersion) importFrom(utils,tail) importFrom(uuid,UUIDgenerate) importFrom(xml2,as_xml_document) flextable/README.md0000644000176200001440000000677714571444335013532 0ustar liggesusersflextable R package ================ [![R build status](https://github.com/davidgohel/flextable/workflows/R-CMD-check/badge.svg)](https://github.com/davidgohel/flextable/actions) [![version](https://www.r-pkg.org/badges/version/flextable)](https://CRAN.R-project.org/package=flextable) ![Active](https://www.repostatus.org/badges/latest/active.svg) The flextable package provides a framework for easily create tables for reporting and publications. Tables can be easily formatted with a set of verbs such as `bold()`, `color()`, they can receive a header of more than one line, cells can be merged or contain an image. The package make it possible to build any table for publication from a `data.frame` and provides sugar function `as_flextable()` to convert several R objects to a flextable, such as an object return from `table()` or a model. Tables can be embedded within HTML, PDF, Word and PowerPoint documents from R Markdown documents and within RTF or Microsoft Word or PowerPoint documents with package officer. Tables can also be rendered as R plots or graphic files (png). flextable formats ``` r flextable(mtcars) %>% theme_vanilla() %>% save_as_docx(path = "mytable.docx") ``` A `flextable` object is a data.frame representation. An API is available to let R users create tables for reporting and control their formatting properties and their layout. The package provides functions that give control over: - header, body and footer content - text, paragraphs, cells and border formatting of any element - displayed values The package also offers a set of high-level functions that allow tabular reporting of statistical models and the creation of complex cross tabulations. ## Examples ``` r library(flextable) set_flextable_defaults( font.family = "Arial", font.size = 10, border.color = "gray", big.mark = "") ft <- flextable(head(mtcars)) |> bold(part = "header") ft ``` ``` r ft |> highlight(i = ~ mpg < 22, j = "disp", color = "#ffe842") |> bg(j = c("hp", "drat", "wt"), bg = scales::col_quantile(palette = c("wheat", "red"), domain =NULL)) |> add_footer_lines("The 'mtcars' dataset") ``` ``` r ggplot2::diamonds[, c("cut", "carat", "price", "clarity", "table")] |> summarizor(by = c("cut")) |> as_flextable(spread_first_col = TRUE) ``` ## Installation ``` r install.packages("flextable") ``` You can get the development version from GitHub: ``` r devtools::install_github("davidgohel/flextable") ``` ## Resources - User guide: - Manuals: - Gallery of examples: ### Getting help / questions If you have questions about how to use the package, visit Stackoverflow and use tags `flextable` and `r` [Stackoverflow link](https://stackoverflow.com/questions/tagged/flextable+r). You can also use to start a discussion. ### Bug reports When you file a [bug report](https://github.com/davidgohel/flextable/issues), please spend some time making it easy for us to reproduce. If you take the time to make the bug report consistent, it will be easier to fix. flextable/man/0000755000176200001440000000000014615640066013003 5ustar liggesusersflextable/man/footers_flextable_at_bkm.Rd0000644000176200001440000000063414572154200020311 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/zz-defunct.R \name{footers_flextable_at_bkm} \alias{footers_flextable_at_bkm} \title{Add flextable at a bookmark location in document's footer} \usage{ footers_flextable_at_bkm(...) } \arguments{ \item{...}{unused} } \description{ Function is now defunct, use \code{\link[=prop_section]{prop_section()}} instead. } \keyword{internal} flextable/man/border_inner_v.Rd0000644000176200001440000000223214565457153016275 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border_inner_v} \alias{border_inner_v} \title{Set vertical inner borders} \usage{ border_inner_v(x, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying a vertical border to inner content of one or all parts of a flextable. } \examples{ library(officer) std_border <- fp_border(color = "orange", width = 1) dat <- iris[c(1:5, 51:55, 101:105), ] ft <- flextable(dat) ft <- border_remove(x = ft) # add inner vertical borders ft <- border_inner_v(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/use_df_printer.Rd0000644000176200001440000000106014375473105016300 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/df_printer.R \name{use_df_printer} \alias{use_df_printer} \title{Set data.frame automatic printing as a flextable} \usage{ use_df_printer() } \description{ Define \code{\link[=df_printer]{df_printer()}} as data.frame print method in an R Markdown document. In a setup run chunk: \if{html}{\out{
}}\preformatted{flextable::use_df_printer() }\if{html}{\out{
}} } \seealso{ \code{\link[=df_printer]{df_printer()}}, \code{\link[=flextable]{flextable()}} } flextable/man/merge_h.Rd0000644000176200001440000000157514476430471014712 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/merge_flextable.R \name{merge_h} \alias{merge_h} \title{Merge flextable cells horizontally} \usage{ merge_h(x, i = NULL, part = "body") } \arguments{ \item{x}{\code{flextable} object} \item{i}{rows where cells have to be merged.} \item{part}{partname of the table where merge has to be done.} } \description{ Merge flextable cells horizontally when consecutive cells have identical values. Text of formatted values are used to compare values. } \examples{ dummy_df <- data.frame( col1 = letters, col2 = letters, stringsAsFactors = FALSE ) ft_merge <- flextable(dummy_df) ft_merge <- merge_h(x = ft_merge) ft_merge } \seealso{ Other flextable merging function: \code{\link{merge_at}()}, \code{\link{merge_h_range}()}, \code{\link{merge_none}()}, \code{\link{merge_v}()} } \concept{flextable merging function} flextable/man/void.Rd0000644000176200001440000000070514476430471014237 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/empty.R \name{void} \alias{void} \title{Delete flextable content} \usage{ void(x, j = NULL, part = "body") } \arguments{ \item{x}{\code{flextable} object} \item{j}{columns selection} \item{part}{partname of the table} } \description{ Set content display as a blank \code{" "}. } \examples{ ftab <- flextable(head(mtcars)) ftab <- void(ftab, ~ vs + am + gear + carb) ftab } flextable/man/as_flextable.glm.Rd0000644000176200001440000000250314565457153016510 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.glm} \alias{as_flextable.glm} \title{Transform a 'glm' object into a flextable} \usage{ \method{as_flextable}{glm}(x, ...) } \arguments{ \item{x}{glm model} \item{...}{unused argument} } \description{ produce a flextable describing a generalized linear model produced by function \code{glm}. You can remove significance stars by setting options \code{options(show.signif.stars = FALSE)}. } \examples{ if (require("broom")) { dat <- attitude dat$high.rating <- (dat$rating > 70) probit.model <- glm(high.rating ~ learning + critical + advance, data = dat, family = binomial(link = "probit")) ft <- as_flextable(probit.model) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/as_highlight.Rd0000644000176200001440000000251214565457153015733 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_highlight} \alias{as_highlight} \title{Highlight chunk} \usage{ as_highlight(x, color) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} \item{color}{color to use as text highlighting color as character vector.} } \description{ The function is producing a chunk with an highlight chunk. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("Sepal.Length", "dummy") ) ft <- compose(ft, j = "dummy", value = as_paragraph(as_highlight(Sepal.Length, color = "yellow")) ) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/to_html.flextable.Rd0000644000176200001440000000225214515040463016700 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{to_html.flextable} \alias{to_html.flextable} \title{Get HTML code as a string} \usage{ \method{to_html}{flextable}(x, type = c("table", "img"), ...) } \arguments{ \item{x}{a flextable object} \item{type}{output type. one of "table" or "img".} \item{...}{unused} } \value{ If \code{type='img'}, the result will be a string containing HTML code of an image tag, otherwise, the result will be a string containing HTML code of a table tag. } \description{ Generate HTML code of corresponding flextable as an HTML table or an HTML image. } \examples{ library(officer) library(flextable) x <- to_html(as_flextable(cars)) } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()} } \concept{flextable print function} flextable/man/highlight.Rd0000644000176200001440000000411214566144245015242 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{highlight} \alias{highlight} \title{Text highlight color} \usage{ highlight(x, i = NULL, j = NULL, color = "yellow", part = "body", source = j) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{color}{color to use as text highlighting color. If a function, function need to return a character vector of colors.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} \item{source}{if color is a function, source is specifying the dataset column to be used as argument to \code{color}. This is only useful if j is colored with values contained in other columns.} } \description{ Change text highlight color of selected rows and columns of a flextable. A function can be used instead of fixed colors. When \code{color} is a function, it is possible to color cells based on values located in other columns, using hidden columns (those not used by argument \code{colkeys}) is a common use case. The argument \code{source} has to be used to define what are the columns to be used for the color definition and the argument \code{j} has to be used to define where to apply the colors and only accept values from \code{colkeys}. } \examples{ my_color_fun <- function(x) { out <- rep("yellow", length(x)) out[x < quantile(x, .75)] <- "pink" out[x < quantile(x, .50)] <- "wheat" out[x < quantile(x, .25)] <- "gray90" out } ft <- flextable(head(mtcars, n = 10)) ft <- highlight(ft, j = "disp", i = ~ disp > 200, color = "yellow") ft <- highlight(ft, j = ~ drat + wt + qsec, color = my_color_fun) ft } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/autofit.Rd0000644000176200001440000000436514540404024014742 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{autofit} \alias{autofit} \title{Adjusts cell widths and heights} \usage{ autofit( x, add_w = 0.1, add_h = 0.1, part = c("body", "header"), unit = "in", hspans = "none" ) } \arguments{ \item{x}{flextable object} \item{add_w}{extra width to add in inches} \item{add_h}{extra height to add in inches} \item{part}{partname of the table (one of 'all', 'body', 'header' or 'footer')} \item{unit}{unit for add_h and add_w, one of "in", "cm", "mm".} \item{hspans}{specifies how cells that are horizontally are included in the calculation. It must be one of the following values "none", "divided" or "included". If "none", widths of horizontally spanned cells is set to 0 (then do not affect the widths); if "divided", widths of horizontally spanned cells is divided by the number of spanned cells; if "included", all widths (included horizontally spanned cells) will be used in the calculation.} } \description{ compute and apply optimized widths and heights (minimum estimated widths and heights for each table columns and rows in inches returned by function \code{\link[=dim_pretty]{dim_pretty()}}). This function is to be used when the table widths and heights should be adjusted to fit the size of the content. The function does not let you adjust a content that is too wide in a paginated document. It simply calculates the width of the columns so that each content has the minimum width necessary to display the content on one line. Note that this function is not related to 'Microsoft Word' \emph{Autofit} feature. There is an alternative to fixed-width layouts that works well with HTML and Word output that can be set with \code{set_table_properties(layout = "autofit")}, see \code{\link[=set_table_properties]{set_table_properties()}}. } \examples{ ft_1 <- flextable(head(mtcars)) ft_1 ft_2 <- autofit(ft_1) ft_2 } \seealso{ Other flextable dimensions: \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/use_model_printer.Rd0000644000176200001440000000133514255321756017015 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{use_model_printer} \alias{use_model_printer} \title{set model automatic printing as a flextable} \usage{ use_model_printer() } \description{ Define \code{\link[=as_flextable]{as_flextable()}} as print method in an R Markdown document for models of class: \itemize{ \item lm \item glm \item models from package 'lme' and 'lme4' \item htest (t.test, chisq.test, ...) \item gam \item kmeans and pam } In a setup run chunk: \if{html}{\out{
}}\preformatted{flextable::use_model_printer() }\if{html}{\out{
}} } \seealso{ \code{\link[=use_df_printer]{use_df_printer()}}, \code{\link[=flextable]{flextable()}} } flextable/man/linerange.Rd0000644000176200001440000000411514565457154015247 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{linerange} \alias{linerange} \title{Mini linerange chunk wrapper} \usage{ linerange( value, min = NULL, max = NULL, rangecol = "#CCCCCC", stickcol = "#FF0000", bg = "transparent", width = 1, height = 0.2, raster_width = 30, unit = "in" ) } \arguments{ \item{value}{values containing the bar size} \item{min}{min bar size. Default min of value} \item{max}{max bar size. Default max of value} \item{rangecol}{bar color} \item{stickcol}{jauge color} \item{bg}{background color} \item{width, height}{size of the resulting png file in inches} \item{raster_width}{number of pixels used as width when interpolating value.} \item{unit}{unit for width and height, one of "in", "cm", "mm".} } \description{ This function is used to insert lineranges into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ myft <- flextable(head(iris, n = 10)) myft <- compose(myft, j = 1, value = as_paragraph( linerange(value = Sepal.Length) ), part = "body" ) autofit(myft) } \seealso{ \code{\link[=compose]{compose()}}, \code{\link[=as_paragraph]{as_paragraph()}} Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/theme_apa.Rd0000644000176200001440000000401214565457154015222 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_apa} \alias{theme_apa} \title{Apply APA theme} \usage{ theme_apa(x, ...) } \arguments{ \item{x}{a flextable object} \item{...}{unused} } \description{ Apply theme APA (the stylistic style of the American Psychological Association) to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(mtcars * 22.22)) ft <- theme_apa(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/as_image.Rd0000644000176200001440000000474014565457153015053 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{as_image} \alias{as_image} \title{Image chunk wrapper} \usage{ as_image(src, width = NULL, height = NULL, unit = "in", guess_size = TRUE, ...) } \arguments{ \item{src}{image filename} \item{width, height}{size of the image file. It can be ignored if parameter \code{guess_size=TRUE}, see parameter \code{guess_size}.} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{guess_size}{If package 'magick' is installed, this option can be used (set it to \code{TRUE} and don't provide values for paramters \code{width} and \code{height}). When the flextable will be printed, the images will be read and width and height will be guessed. This should be avoid if possible as it can be an extensive task when several images.} \item{...}{unused argument} } \description{ The function lets add images within flextable objects with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}} \if{html}{\out{ as_image illustration }} } } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ img.file <- file.path( R.home("doc"), "html", "logo.jpg" ) if (require("magick")) { myft <- flextable(head(iris)) myft <- compose(myft, i = 1:3, j = 1, value = as_paragraph( as_image(src = img.file), " ", as_chunk(Sepal.Length, props = fp_text_default(color = "red") ) ), part = "body" ) ft <- autofit(myft) ft } } \seealso{ \code{\link[=compose]{compose()}}, \code{\link[=as_paragraph]{as_paragraph()}} Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/colformat_lgl.Rd0000644000176200001440000000222514565457154016127 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_lgl} \alias{colformat_lgl} \title{Format logical cells} \usage{ colformat_lgl( x, i = NULL, j = NULL, true = "true", false = "false", na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{false, true}{string to be used for logical} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format logical cells in a flextable. } \examples{ dat <- data.frame(a = c(TRUE, FALSE), b = c(FALSE, TRUE)) z <- flextable(dat) z <- colformat_lgl(x = z, j = c("a", "b")) autofit(z) } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/plot_chunk.Rd0000644000176200001440000000467314565457154015462 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{plot_chunk} \alias{plot_chunk} \title{Mini plots chunk wrapper} \usage{ plot_chunk( value, width = 1, height = 0.2, type = "box", free_scale = FALSE, unit = "in", ... ) } \arguments{ \item{value}{a numeric vector, stored in a list column.} \item{width, height}{size of the resulting png file in inches} \item{type}{type of the plot: 'box', 'line', 'points' or 'density'.} \item{free_scale}{Should scales be free (TRUE or FALSE, the default value).} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{...}{arguments sent to plot functions (see \code{\link[=par]{par()}})} } \description{ This function is used to insert mini plots into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } Available plots are 'box', 'line', 'points', 'density'. } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ library(data.table) library(flextable) z <- as.data.table(iris) z <- z[, list( Sepal.Length = mean(Sepal.Length, na.rm = TRUE), z = list(.SD$Sepal.Length) ), by = "Species"] ft <- flextable(z, col_keys = c("Species", "Sepal.Length", "box", "density") ) ft <- mk_par(ft, j = "box", value = as_paragraph( plot_chunk( value = z, type = "box", border = "red", col = "transparent" ) )) ft <- mk_par(ft, j = "density", value = as_paragraph( plot_chunk(value = z, type = "dens", col = "red") )) ft <- set_table_properties(ft, layout = "autofit", width = .6) ft <- set_header_labels(ft, box = "boxplot", density = "density") theme_vanilla(ft) } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()} } \concept{chunk elements for paragraph} flextable/man/as_flextable.lm.Rd0000644000176200001440000000233514565457153016344 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.lm} \alias{as_flextable.lm} \title{Transform a 'lm' object into a flextable} \usage{ \method{as_flextable}{lm}(x, ...) } \arguments{ \item{x}{lm model} \item{...}{unused argument} } \description{ produce a flextable describing a linear model produced by function \code{lm}. You can remove significance stars by setting options \code{options(show.signif.stars = FALSE)}. } \examples{ if (require("broom")) { lmod <- lm(rating ~ complaints + privileges + learning + raises + critical, data = attitude) ft <- as_flextable(lmod) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/hyperlink_text.Rd0000644000176200001440000000407314565457154016357 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{hyperlink_text} \alias{hyperlink_text} \title{Chunk of text with hyperlink} \usage{ hyperlink_text(x, props = NULL, formatter = format_fun, url, ...) } \arguments{ \item{x}{text or any element that can be formatted as text with function provided in argument \code{formatter}.} \item{props}{an \code{\link[=fp_text_default]{fp_text_default()}} or \code{\link[officer:fp_text]{officer::fp_text()}} object to be used to format the text. If not specified, it will be the default value corresponding to the cell.} \item{formatter}{a function that will format x as a character vector.} \item{url}{url to be used} \item{...}{additional arguments for \code{formatter} function.} } \description{ The function lets add hyperlinks within flextable objects. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. URL are not encoded, they are preserved 'as is'. } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. } \examples{ dat <- data.frame( col = "Google it", href = "https://www.google.fr/search?source=hp&q=flextable+R+package", stringsAsFactors = FALSE ) ftab <- flextable(dat) ftab <- compose( x = ftab, j = "col", value = as_paragraph( "This is a link: ", hyperlink_text(x = col, url = href) ) ) ftab } \seealso{ \code{\link[=compose]{compose()}} Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/prepend_chunks.Rd0000644000176200001440000000202314375473105016300 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/append_chunk.R \name{prepend_chunks} \alias{prepend_chunks} \title{Prepend chunks to flextable content} \usage{ prepend_chunks(x, ..., i = NULL, j = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{...}{chunks to be prepended, see \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=gg_chunk]{gg_chunk()}} and other chunk elements for paragraph.} \item{i}{rows selection} \item{j}{column selection} \item{part}{partname of the table (one of 'body', 'header', 'footer')} } \description{ prepend chunks (for example chunk \code{\link[=as_chunk]{as_chunk()}}) in a flextable. } \examples{ x <- flextable(head(iris)) x <- prepend_chunks( x, i = 1, j = 1, colorize(as_b("Hello "), color = "red"), colorize(as_i("World"), color = "magenta") ) x } \seealso{ Other functions for mixed content paragraphs: \code{\link{append_chunks}()}, \code{\link{as_paragraph}()}, \code{\link{compose}()} } \concept{functions for mixed content paragraphs} flextable/man/knit_print.flextable.Rd0000644000176200001440000001641714515040434017421 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{knit_print.flextable} \alias{knit_print.flextable} \title{Render flextable with 'knitr'} \usage{ \method{knit_print}{flextable}(x, ...) } \arguments{ \item{x}{a \code{flextable} object} \item{...}{unused.} } \description{ Function used to render flextable in knitr/rmarkdown documents. You should not call this method directly. This function is used by the knitr package to automatically display a flextable in an "R Markdown" document from a chunk. However, it is recommended to read its documentation in order to get familiar with the different options available. R Markdown outputs can be : \itemize{ \item HTML \item 'Microsoft Word' \item 'Microsoft PowerPoint' \item PDF } \if{html}{\figure{fig_formats.png}{options: width="200"}} Table captioning is a flextable feature compatible with R Markdown documents. The feature is available for HTML, PDF and Word documents. Compatibility with the "bookdown" package is also ensured, including the ability to produce captions so that they can be used in cross-referencing. For Word, it's recommanded to work with package 'officedown' that supports all features of flextable. } \note{ Supported formats require some minimum \href{https://pandoc.org/installing.html}{pandoc} versions: \tabular{rc}{ \strong{Output format} \tab \strong{pandoc minimal version} \cr HTML \tab >= 1.12\cr Word (docx) \tab >= 2.0 \cr PowerPoint (pptx) \tab >= 2.4 \cr PDF \tab >= 1.12 } } \section{Chunk options}{ Some features, often specific to an output format, are available to help you configure some global settings relatve to the table output. knitr's chunk options are to be used to change the default settings: \itemize{ \item HTML, PDF and Word: \itemize{ \item \code{ft.align}: flextable alignment, supported values are 'left', 'center' and 'right'. Its default value is 'center'. } \item HTML only: \itemize{ \item \code{ft.htmlscroll}, can be \code{TRUE} or \code{FALSE} (default) to enable horizontal scrolling. Use \code{\link[=set_table_properties]{set_table_properties()}} for more options about scrolling. } \item Word only: \itemize{ \item \code{ft.split} Word option 'Allow row to break across pages' can be activated when TRUE (default value). \item \code{ft.keepnext} defunct in favor of \code{\link[=paginate]{paginate()}} } \item PDF only: \itemize{ \item \code{ft.tabcolsep} space between the text and the left/right border of its containing cell, the default value is 0 points. \item \code{ft.arraystretch} height of each row relative to its default height, the default value is 1.5. \item \code{ft.latex.float} type of floating placement in the document, one of: \itemize{ \item 'none' (the default value), table is placed after the preceding paragraph. \item 'float', table can float to a place in the text where it fits best \item 'wrap-r', wrap text around the table positioned to the right side of the text \item 'wrap-l', wrap text around the table positioned to the left side of the text \item 'wrap-i', wrap text around the table positioned inside edge-near the binding \item 'wrap-o', wrap text around the table positioned outside edge-far from the binding } } \item PowerPoint only: \itemize{ \item \code{ft.left}, \code{ft.top} Position should be defined with these options. Theses are the top left coordinates in inches of the placeholder that will contain the table. Their default values are 1 and 2 inches. } } If some values are to be used all the time in the same document, it is recommended to set these values in a 'knitr r chunk' by using function \code{knitr::opts_chunk$set(ft.split=FALSE, ...)}. } \section{Table caption}{ Captions can be defined in two ways. The first is with the \code{\link[=set_caption]{set_caption()}} function. If it is used, the other method will be ignored. The second method is by using knitr chunk option \code{tab.cap}. \if{html}{\out{
}}\preformatted{set_caption(x, caption = "my caption") }\if{html}{\out{
}} If \code{set_caption} function is not used, caption identifier will be read from knitr's chunk option \code{tab.id}. Note that in a bookdown and when not using \code{officedown::rdocx_document()}, the usual numbering feature of bookdown is used. \code{tab.id='my_id'}. Some options are available to customise captions for any output:\tabular{lcc}{ \strong{label} \tab \strong{name} \tab \strong{value} \cr Word stylename to use for table captions. \tab tab.cap.style \tab NULL \cr caption id/bookmark \tab tab.id \tab NULL \cr caption \tab tab.cap \tab NULL \cr display table caption on top of the table or not \tab tab.topcaption \tab TRUE \cr caption table sequence identifier. \tab tab.lp \tab "tab:" \cr } Word output when \code{officedown::rdocx_document()} is used is coming with more options such as ability to choose the prefix for numbering chunk for example. The table below expose these options:\tabular{lcc}{ \strong{label} \tab \strong{name} \tab \strong{value} \cr prefix for numbering chunk (default to "Table "). \tab tab.cap.pre \tab Table \cr suffix for numbering chunk (default to ": "). \tab tab.cap.sep \tab " :" \cr title number depth \tab tab.cap.tnd \tab 0 \cr caption prefix formatting properties \tab tab.cap.fp_text \tab fp_text_lite(bold = TRUE) \cr separator to use between title number and table number. \tab tab.cap.tns \tab "-" \cr } } \section{HTML output}{ HTML output is using shadow dom to encapsule the table into an isolated part of the page so that no clash happens with styles. } \section{PDF output}{ Some features are not implemented in PDF due to technical infeasibility. These are the padding, line_spacing and height properties. Note also justified text is not supported and is transformed to left. It is recommended to set theses values in a 'knitr r chunk' so that they are permanent all along the document: \code{knitr::opts_chunk$set(ft.tabcolsep=0, ft.latex.float = "none")}. See \code{\link[=add_latex_dep]{add_latex_dep()}} if caching flextable results in 'R Markdown' documents. } \section{PowerPoint output}{ Auto-adjust Layout is not available for PowerPoint, PowerPoint only support fixed layout. It's then often necessary to call function \code{\link[=autofit]{autofit()}} so that the columns' widths are adjusted if user does not provide the withs. Images cannot be integrated into tables with the PowerPoint format. } \examples{ \dontrun{ library(rmarkdown) if (pandoc_available() && pandoc_version() > numeric_version("2")) { demo_loop <- system.file( package = "flextable", "examples/rmd", "demo.Rmd" ) rmd_file <- tempfile(fileext = ".Rmd") file.copy(demo_loop, to = rmd_file, overwrite = TRUE) render( input = rmd_file, output_format = "html_document", output_file = "demo.html" ) } } } \seealso{ \code{\link[=paginate]{paginate()}} Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/height.Rd0000644000176200001440000000311514364612403014535 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{height} \alias{height} \alias{height_all} \title{Set flextable rows height} \usage{ height(x, i = NULL, height, part = "body", unit = "in") height_all(x, height, part = "all", unit = "in") } \arguments{ \item{x}{flextable object} \item{i}{rows selection} \item{height}{height in inches} \item{part}{partname of the table} \item{unit}{unit for height, one of "in", "cm", "mm".} } \description{ control rows height for a part of the flextable when the line height adjustment is "atleast" or "exact" (see \code{\link[=hrule]{hrule()}}). } \note{ This function has no effect when the rule for line height is set to "auto" (see \code{\link[=hrule]{hrule()}}), which is the default case, except with PowerPoint which does not support this automatic line height adjustment feature. } \section{height_all}{ \code{height_all} is a convenient function for setting the same height to all rows (selected with argument \code{part}). } \examples{ ft_1 <- flextable(head(iris)) ft_1 <- height(ft_1, height = .5) ft_1 <- hrule(ft_1, rule = "exact") ft_1 ft_2 <- flextable(head(iris)) ft_2 <- height_all(ft_2, height = 1) ft_2 <- hrule(ft_2, rule = "exact") ft_2 } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/hline_top.Rd0000644000176200001440000000231614565457154015265 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{hline_top} \alias{hline_top} \title{Set top horizontal border} \usage{ hline_top(x, j = NULL, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{j}{columns selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying an horizontal border to the top of one or all parts of a flextable. The line is the top border of selected parts. } \examples{ library(officer) big_border <- fp_border(color = "orange", width = 3) ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add horizontal border on top ft <- hline_top(ft, part = "all", border = big_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/as_grouped_data.Rd0000644000176200001440000000207714476430470016422 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_grouped_data} \alias{as_grouped_data} \title{Add row separators to grouped data} \usage{ as_grouped_data(x, groups, columns = NULL, expand_single = TRUE) } \arguments{ \item{x}{dataset} \item{groups}{columns names to be used as row separators.} \item{columns}{columns names to keep} \item{expand_single}{if FALSE, groups with only one row will not be expanded with a title row. If TRUE (the default), single row groups and multi-row groups are all restructured.} } \description{ Repeated consecutive values of group columns will be used to define the title of the groups and will be added as a row title. } \examples{ # as_grouped_data ----- library(data.table) CO2 <- CO2 setDT(CO2) CO2$conc <- as.integer(CO2$conc) data_co2 <- dcast(CO2, Treatment + conc ~ Type, value.var = "uptake", fun.aggregate = mean ) data_co2 data_co2 <- as_grouped_data(x = data_co2, groups = c("Treatment")) data_co2 } \seealso{ \code{\link[=as_flextable.grouped_data]{as_flextable.grouped_data()}} } flextable/man/colformat_date.Rd0000644000176200001440000000225214402205763016251 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_date} \alias{colformat_date} \title{Format date cells} \usage{ colformat_date( x, i = NULL, j = NULL, fmt_date = get_flextable_defaults()$fmt_date, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{fmt_date}{see \code{\link[=strptime]{strptime()}}} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format date cells in a flextable. } \examples{ dat <- data.frame( z = Sys.Date() + 1:3, w = Sys.Date() - 1:3 ) ft <- flextable(dat) ft <- colformat_date(x = ft) ft <- autofit(ft) ft } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/theme_box.Rd0000644000176200001440000000365514565457154015265 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_box} \alias{theme_box} \title{Apply box theme} \usage{ theme_box(x) } \arguments{ \item{x}{a flextable object} } \description{ Apply theme box to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_box(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/colformat_num.Rd0000644000176200001440000000520014565457154016144 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_num} \alias{colformat_num} \title{Format numeric cells} \usage{ colformat_num( x, i = NULL, j = NULL, big.mark = get_flextable_defaults()$big.mark, decimal.mark = get_flextable_defaults()$decimal.mark, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "", ... ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{big.mark, decimal.mark}{see \code{\link[=format]{format()}}} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} \item{...}{additional argument for function \code{\link[=format]{format()}}, \code{scientific} and \code{digits} can not be used.} } \description{ Format numeric cells in a flextable. The function is different from \code{\link[=colformat_double]{colformat_double()}} on numeric type columns. The function uses the \code{\link[=format]{format()}} function of R on numeric type columns. So this is normally what you see on the R console most of the time (but scientific mode is disabled and NA are replaced). } \section{format call}{ Function \code{\link[=format]{format()}} is called with the following values: \itemize{ \item \code{trim} is set to TRUE, \item \code{scientific} is set to FALSE, \item \code{big.mark} is set to the value of \code{big.mark} argument, \item \code{decimal.mark} is set to the value of \code{decimal.mark} argument, \item other arguments are passed 'as is' to the format function. } argument \code{digits} is ignored as it is not the same \code{digits} that users want, this one will be used by \code{\link[=format]{format()}} and not \code{\link[=formatC]{formatC()}}. To change the digit argument use \code{options(digits=4)} instead. This argument will not be changed because \code{colformat_num()} is supposed to format things roughly as what you see on the R console. If these functions does not fit your needs, use \code{\link[=set_formatter]{set_formatter()}} that lets you use any format function. } \examples{ dat <- mtcars dat[2, 1] <- NA ft <- flextable(head(dat)) ft <- colformat_num( x = ft, big.mark = " ", decimal.mark = ",", na_str = "N/A" ) ft <- autofit(ft) ft } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/as_flextable.xtable.Rd0000644000176200001440000000561014565457153017212 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/xtable_to_flextable.R \name{as_flextable.xtable} \alias{as_flextable.xtable} \title{Transform a 'xtable' object into a flextable} \usage{ \method{as_flextable}{xtable}( x, text.properties = fp_text_default(), format.args = getOption("xtable.format.args", NULL), rowname_col = "rowname", hline.after = getOption("xtable.hline.after", c(-1, 0, nrow(x))), NA.string = getOption("xtable.NA.string", ""), include.rownames = TRUE, rotate.colnames = getOption("xtable.rotate.colnames", FALSE), ... ) } \arguments{ \item{x}{\code{xtable} object} \item{text.properties}{default text formatting properties} \item{format.args}{List of arguments for the formatC function. See argument \code{format.args} of \code{print.xtable}. Not yet implemented.} \item{rowname_col}{colname used for row names column} \item{hline.after}{see \code{?print.xtable}.} \item{NA.string}{see \code{?print.xtable}.} \item{include.rownames}{see \code{?print.xtable}.} \item{rotate.colnames}{see \code{?print.xtable}.} \item{...}{unused arguments} } \description{ Get a \code{flextable} object from a \code{xtable} object. } \examples{ library(officer) if( require("xtable") ){ data(tli) tli.table <- xtable(tli[1:10, ]) align(tli.table) <- rep("r", 6) align(tli.table) <- "|r|r|clr|r|" ft_1 <- as_flextable( tli.table, rotate.colnames = TRUE, include.rownames = FALSE) ft_1 <- height(ft_1, i = 1, part = "header", height = 1) ft_1 \donttest{ Grade3 <- c("A","B","B","A","B","C","C","D","A","B", "C","C","C","D","B","B","D","C","C","D") Grade6 <- c("A","A","A","B","B","B","B","B","C","C", "A","C","C","C","D","D","D","D","D","D") Cohort <- table(Grade3, Grade6) ft_2 <- as_flextable(xtable(Cohort)) ft_2 <- set_header_labels(ft_2, rowname = "Grade 3") ft_2 <- autofit(ft_2) ft_2 <- add_header(ft_2, A = "Grade 6") ft_2 <- merge_at(ft_2, i = 1, j = seq_len( ncol(Cohort) ) + 1, part = "header" ) ft_2 <- bold(ft_2, j = 1, bold = TRUE, part = "body") ft_2 <- height_all(ft_2, part = "header", height = .4) ft_2 temp.ts <- ts(cumsum(1 + round(rnorm(100), 0)), start = c(1954, 7), frequency = 12) ft_3 <- as_flextable(x = xtable(temp.ts, digits = 0), NA.string = "-") ft_3 } detach("package:xtable", unload = TRUE) } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()} } \concept{as_flextable methods} flextable/man/set_header_footer_df.Rd0000644000176200001440000000452414565457154017441 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{set_header_footer_df} \alias{set_header_footer_df} \alias{set_header_df} \alias{set_footer_df} \title{Set flextable's header or footer rows} \usage{ set_header_df(x, mapping = NULL, key = "col_keys") set_footer_df(x, mapping = NULL, key = "col_keys") } \arguments{ \item{x}{a \code{flextable} object} \item{mapping}{a \code{data.frame} specyfing for each colname content of the column.} \item{key}{column to use as key when joigning data_mapping.} } \description{ Use a data.frame to specify flextable's header or footer rows. The data.frame must contain a column whose values match flextable \code{col_keys} argument, this column will be used as join key. The other columns will be displayed as header or footer rows. The leftmost column is used as the top header/footer row and the rightmost column is used as the bottom header/footer row. } \examples{ typology <- data.frame( col_keys = c( "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species" ), what = c("Sepal", "Sepal", "Petal", "Petal", "Species"), measure = c("Length", "Width", "Length", "Width", "Species"), stringsAsFactors = FALSE ) ft_1 <- flextable(head(iris)) ft_1 <- set_header_df(ft_1, mapping = typology, key = "col_keys") ft_1 <- merge_h(ft_1, part = "header") ft_1 <- merge_v(ft_1, j = "Species", part = "header") ft_1 <- theme_vanilla(ft_1) ft_1 <- fix_border_issues(ft_1) ft_1 typology <- data.frame( col_keys = c( "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species" ), unit = c("(cm)", "(cm)", "(cm)", "(cm)", ""), stringsAsFactors = FALSE ) ft_2 <- set_footer_df(ft_1, mapping = typology, key = "col_keys") ft_2 <- italic(ft_2, italic = TRUE, part = "footer") ft_2 <- theme_booktabs(ft_2) ft_2 <- fix_border_issues(ft_2) ft_2 } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/as_b.Rd0000644000176200001440000000230714565457153014207 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_b} \alias{as_b} \title{Bold chunk} \usage{ as_b(x) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} } \description{ The function is producing a chunk with bold font. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("Sepal.Length", "dummy") ) ft <- compose(ft, j = "dummy", value = as_paragraph( as_b(Sepal.Length) ) ) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/ph_with.flextable.Rd0000644000176200001440000000355014600641501016671 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ph_with.R \name{ph_with.flextable} \alias{ph_with.flextable} \title{Add a flextable into a PowerPoint slide} \usage{ \method{ph_with}{flextable}(x, value, location, ...) } \arguments{ \item{x}{a pptx device} \item{value}{flextable object} \item{location}{a location for a placeholder. See \code{\link[officer:ph_location_type]{officer::ph_location_type()}} for example.} \item{...}{unused arguments.} } \description{ Add a flextable in a PowerPoint document object produced by \code{\link[officer:read_pptx]{officer::read_pptx()}}. This function will create a native PowerPoint table from the flextable and the result can be eventually edited. } \note{ The width and height of the table can not be set with \code{location}. Use functions \code{\link[=width]{width()}}, \code{\link[=height]{height()}}, \code{\link[=autofit]{autofit()}} and \code{\link[=dim_pretty]{dim_pretty()}} instead. The overall size is resulting from cells, paragraphs and text properties (i.e. padding, font size, border widths). } \section{caption}{ Captions are not printed in PowerPoint slides. While captions are useful for document formats like Word, RTF, HTML, or PDF, they aren't directly supported in PowerPoint slides. Unlike documents with a defined layout, PowerPoint slides lack a structured document flow. They don't function like HTML documents or paginated formats (RTF, Word, PDF). This makes it technically challenging to determine the ideal placement for a caption within a slide. Additionally, including a caption within the table itself isn't feasible. } \examples{ library(officer) ft <- flextable(head(iris)) doc <- read_pptx() doc <- add_slide(doc, "Title and Content", "Office Theme") doc <- ph_with(doc, ft, location = ph_location_left()) fileout <- tempfile(fileext = ".pptx") print(doc, target = fileout) } flextable/man/theme_booktabs.Rd0000644000176200001440000000404614565457154016274 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_booktabs} \alias{theme_booktabs} \title{Apply booktabs theme} \usage{ theme_booktabs(x, bold_header = FALSE, ...) } \arguments{ \item{x}{a flextable object} \item{bold_header}{header will be bold if TRUE.} \item{...}{unused} } \description{ Apply theme booktabs to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_booktabs(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/as_sub.Rd0000644000176200001440000000242014565457153014553 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_sub} \alias{as_sub} \title{Subscript chunk} \usage{ as_sub(x) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} } \description{ The function is producing a chunk with subscript vertical alignment. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("dummy")) ft <- compose(ft, i = 1, j = "dummy", part = "header", value = as_paragraph( as_sub("Sepal.Length"), " anything " ) ) ft <- autofit(ft) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/add_body_row.Rd0000644000176200001440000000544114565457153015741 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_body_row} \alias{add_body_row} \title{Add body labels} \usage{ add_body_row(x, top = TRUE, values = list(), colwidths = integer(0)) } \arguments{ \item{x}{a flextable object} \item{top}{should the row be inserted at the top or the bottom.} \item{values}{values to add. It can be a \code{list}, a \code{character()} vector or a call to \code{\link[=as_paragraph]{as_paragraph()}}. If it is a list, it can be a named list with the names of the columns of the original data.frame or the \code{colkeys}; this is the recommended method because it allows to keep the original data types and therefore allows to perform conditional formatting. If a character, columns of the original data.frame stored in the flextable object are changed to \code{character()}; this is often not an issue with footer and header but can be inconvenient if adding rows into body as it will change data types to character and prevent efficient conditional formatting.} \item{colwidths}{the number of columns to merge in the row for each label} } \description{ Add a row of new columns labels in body part. Labels can be spanned along multiple columns, as merged cells. Labels are associated with a number of columns to merge that default to one if not specified. In this case, you have to make sure that the number of labels is equal to the number of columns displayed. The function can add only one single row by call. Labels can also be formatted with \code{\link[=as_paragraph]{as_paragraph()}}. } \examples{ library(flextable) ft01 <- fp_text_default(color = "red") ft02 <- fp_text_default(color = "orange") pars <- as_paragraph( as_chunk(c("(1)", "(2)"), props = ft02), " ", as_chunk( c( "My tailor is rich", "My baker is rich" ), props = ft01 ) ) ft_1 <- flextable(head(mtcars)) ft_1 <- add_body_row(ft_1, values = pars, colwidths = c(5, 6), top = FALSE ) ft_1 <- add_body_row(ft_1, values = pars, colwidths = c(3, 8), top = TRUE ) ft_1 <- theme_box(ft_1) ft_1 ft_2 <- flextable(head(airquality)) ft_2 <- add_body_row(ft_2, values = c("blah", "bleeeh"), colwidths = c(4, 2), top = TRUE ) ft_2 <- theme_box(ft_2) ft_2 } \seealso{ \code{\link[=flextable]{flextable()}}, \code{\link[=set_caption]{set_caption()}} Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/style.Rd0000644000176200001440000000226714364612403014434 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{style} \alias{style} \title{Set flextable style} \usage{ style( x, i = NULL, j = NULL, pr_t = NULL, pr_p = NULL, pr_c = NULL, part = "body" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{pr_t}{object(s) of class \code{fp_text}} \item{pr_p}{object(s) of class \code{fp_par}} \item{pr_c}{object(s) of class \code{fp_cell}} \item{part}{partname of the table (one of 'all', 'body', 'header' or 'footer')} } \description{ Modify flextable text, paragraphs and cells formatting properties. It allows to specify a set of formatting properties for a selection instead of using multiple functions (.i.e \code{bold}, \code{italic}, \code{bg}) that should all be applied to the same selection of rows and columns. } \examples{ library(officer) def_cell <- fp_cell(border = fp_border(color = "wheat")) def_par <- fp_par(text.align = "center") ft <- flextable(head(mtcars)) ft <- style(ft, pr_c = def_cell, pr_p = def_par, part = "all") ft <- style(ft, ~ drat > 3.5, ~ vs + am + gear + carb, pr_t = fp_text(color = "red", italic = TRUE) ) ft } flextable/man/ncol_keys.Rd0000644000176200001440000000126714021743006015253 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/nrowcol.R \name{ncol_keys} \alias{ncol_keys} \title{Number of columns} \usage{ ncol_keys(x) } \arguments{ \item{x}{flextable object} } \description{ returns the number of columns displayed } \examples{ library(flextable) ft <- qflextable(head(cars)) ncol_keys(ft) } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/separate_header.Rd0000644000176200001440000000506714565457154016426 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{separate_header} \alias{separate_header} \title{Split column names using a separator into multiple rows} \usage{ separate_header( x, opts = c("span-top", "center-hspan", "bottom-vspan", "default-theme"), split = "[_\\\\.]", fixed = FALSE ) } \arguments{ \item{x}{a flextable object} \item{opts}{Optional treatments to apply to the resulting header part. This should be a character vector with support for multiple values. Supported values include: \itemize{ \item "span-top": This operation spans empty cells with the first non-empty cell, applied column by column. \item "center-hspan": Center the cells that are horizontally spanned. \item "bottom-vspan": Aligns to the bottom the cells treated at the when "span-top" is applied. \item "default-theme": Applies the theme set in \code{set_flextable_defaults(theme_fun = ...)} to the new header part. }} \item{split}{a regular expression (unless \code{fixed = TRUE}) to use for splitting.} \item{fixed}{logical. If TRUE match \code{split} exactly, otherwise use regular expressions.} } \description{ This function is used to separate and place individual labels in their own rows if your variable names contain multiple delimited labels. \if{html}{\out{ add_header illustration }} } \examples{ library(flextable) x <- data.frame( Species = as.factor(c("setosa", "versicolor", "virginica")), Sepal.Length_mean = c(5.006, 5.936, 6.588), Sepal.Length_sd = c(0.35249, 0.51617, 0.63588), Sepal.Width_mean = c(3.428, 2.77, 2.974), Sepal.Width_sd = c(0.37906, 0.3138, 0.3225), Petal.Length_mean = c(1.462, 4.26, 5.552), Petal.Length_sd = c(0.17366, 0.46991, 0.55189), Petal.Width_mean = c(0.246, 1.326, 2.026), Petal.Width_sd = c(0.10539, 0.19775, 0.27465) ) ft_1 <- flextable(x) ft_1 <- colformat_double(ft_1, digits = 2) ft_1 <- theme_box(ft_1) ft_1 <- separate_header( x = ft_1, opts = c("span-top", "bottom-vspan") ) ft_1 } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/dim.flextable.Rd0000644000176200001440000000140114015203005015762 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{dim.flextable} \alias{dim.flextable} \title{Get widths and heights of flextable} \usage{ \method{dim}{flextable}(x) } \arguments{ \item{x}{flextable object} } \description{ returns widths and heights for each table columns and rows. Values are expressed in inches. } \examples{ ftab <- flextable(head(iris)) dim(ftab) } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/fmt_dbl.Rd0000644000176200001440000000151514570173725014706 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_dbl} \alias{fmt_dbl} \title{Format numerical data} \usage{ fmt_dbl(x) } \arguments{ \item{x}{numeric values} } \description{ The function formats numeric vectors. } \examples{ library(flextable) df <- data.frame(zz = .45) ft_1 <- flextable(df) ft_1 <- mk_par( x = ft_1, j = 1, part = "body", value = as_paragraph(as_chunk(zz, formatter = fmt_dbl)) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/as_flextable.table.Rd0000644000176200001440000000225014565457153017017 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/df_printer.R \name{as_flextable.table} \alias{as_flextable.table} \title{Transform a 'table' object into a flextable} \usage{ \method{as_flextable}{table}(x, ...) } \arguments{ \item{x}{table object} \item{...}{arguments used by \code{\link[=proc_freq]{proc_freq()}}.} } \description{ produce a flextable describing a count table produced by function \code{table()}. This function uses the \code{\link[=proc_freq]{proc_freq()}} function. } \examples{ tab <- with(warpbreaks, table(wool, tension)) ft <- as_flextable(tab) ft } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/border_inner.Rd0000644000176200001440000000226114565457153015752 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border_inner} \alias{border_inner} \title{Set vertical & horizontal inner borders} \usage{ border_inner(x, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying a vertical and horizontal borders to inner content of one or all parts of a flextable. } \examples{ library(officer) std_border <- fp_border(color = "orange", width = 1) dat <- iris[c(1:5, 51:55, 101:105), ] ft <- flextable(dat) ft <- border_remove(x = ft) # add inner vertical borders ft <- border_inner(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/fmt_n_percent.Rd0000644000176200001440000000261414570173724016122 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_n_percent} \alias{fmt_n_percent} \title{Format content for count data} \usage{ fmt_n_percent(n, pct, digit = 1) } \arguments{ \item{n}{count values} \item{pct}{percent values} \item{digit}{number of digits for the percentages} } \description{ The function formats counts and percentages as \verb{n (xx.x\%)}. If percentages are missing, they are not printed. } \examples{ library(flextable) df <- structure( list( cut = structure( .Data = 1:5, levels = c( "Fair", "Good", "Very Good", "Premium", "Ideal" ), class = c("ordered", "factor") ), n = c(1610L, 4906L, 12082L, 13791L, 21551L), pct = c(0.0299, 0.0909, 0.2239, 0.2557, 0.3995) ), row.names = c(NA, -5L), class = "data.frame" ) ft_1 <- flextable(df, col_keys = c("cut", "txt")) ft_1 <- mk_par( x = ft_1, j = "txt", value = as_paragraph(fmt_n_percent(n, pct)) ) ft_1 <- align(ft_1, j = "txt", part = "all", align = "right") ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/as_flextable.gam.Rd0000644000176200001440000000255614565457153016505 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable_gam.R \name{as_flextable.gam} \alias{as_flextable.gam} \title{Transform a 'gam' model into a flextable} \usage{ \method{as_flextable}{gam}(x, ...) } \arguments{ \item{x}{gam model} \item{...}{unused argument} } \description{ produce a flextable describing a generalized additive model produced by function \code{mgcv::gam}. \if{html}{\out{ as_flextable.gam illustration }} } \examples{ if (require("mgcv")) { set.seed(2) # Simulated data dat <- gamSim(1, n = 400, dist = "normal", scale = 2) # basic GAM model b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat) ft <- as_flextable(b) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/hline_bottom.Rd0000644000176200001440000000235414565457154015771 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{hline_bottom} \alias{hline_bottom} \title{Set bottom horizontal border} \usage{ hline_bottom(x, j = NULL, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{j}{columns selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying an horizontal border to the bottom of one or all parts of a flextable. The line is the bottom border of selected parts. } \examples{ library(officer) big_border <- fp_border(color = "orange", width = 3) ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add/replace horizontal border on bottom ft <- hline_bottom(ft, part = "body", border = big_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/colorize.Rd0000644000176200001440000000246714565457154015141 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{colorize} \alias{colorize} \title{Colorize chunk} \usage{ colorize(x, color) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} \item{color}{color to use as text highlighting color as character vector.} } \description{ The function is producing a chunk with a font in color. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("Sepal.Length", "dummy") ) ft <- compose(ft, j = "dummy", value = as_paragraph(colorize(Sepal.Length, color = "red")) ) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/as_chunk.Rd0000644000176200001440000000361314565457153015077 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_chunk} \alias{as_chunk} \title{Chunk of text wrapper} \usage{ as_chunk(x, props = NULL, formatter = format_fun, ...) } \arguments{ \item{x}{text or any element that can be formatted as text with function provided in argument \code{formatter}.} \item{props}{an \code{\link[=fp_text_default]{fp_text_default()}} or \code{\link[officer:fp_text]{officer::fp_text()}} object to be used to format the text. If not specified, it will be the default value corresponding to the cell.} \item{formatter}{a function that will format x as a character vector.} \item{...}{additional arguments for \code{formatter} function.} } \description{ The function lets add formated text in flextable cells. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. It should be used inside a call to \code{\link[=as_paragraph]{as_paragraph()}}. } \examples{ library(officer) ft <- flextable(head(iris)) ft <- compose(ft, j = "Sepal.Length", value = as_paragraph( "Sepal.Length value is ", as_chunk(Sepal.Length, props = fp_text(color = "red")) ), part = "body" ) ft <- color(ft, color = "gray40", part = "all") ft <- autofit(ft) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/fix_border_issues.Rd0000644000176200001440000000201014476430470017002 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/border_fix.R \name{fix_border_issues} \alias{fix_border_issues} \title{Fix border issues when cell are merged} \usage{ fix_border_issues(x, part = "all") } \arguments{ \item{x}{flextable object} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ When cells are merged, the rendered borders will be those of the first cell. If a column is made of three merged cells, the bottom border that will be seen will be the bottom border of the first cell in the column. From a user point of view, this is wrong, the bottom should be the one defined for cell 3. This function modify the border values to avoid that effect. } \examples{ library(officer) dat <- data.frame(a = 1:5, b = 6:10) ft <- flextable(dat) ft <- theme_box(ft) ft <- merge_at(ft, i = 4:5, j = 1, part = "body") ft <- hline(ft, i = 5, part = "body", border = fp_border(color = "red", width = 5) ) print(ft) ft <- fix_border_issues(ft) print(ft) } flextable/man/italic.Rd0000644000176200001440000000202414566144245014540 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{italic} \alias{italic} \title{Set italic font} \usage{ italic(x, i = NULL, j = NULL, italic = TRUE, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{italic}{boolean value} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change font decoration of selected rows and columns of a flextable. } \examples{ ft <- flextable(head(mtcars)) ft <- italic(ft, italic = TRUE, part = "header") } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/information_data_chunk.Rd0000644000176200001440000000317214552463753020011 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/read_structure.R \name{information_data_chunk} \alias{information_data_chunk} \title{content chunk related information of a flextable} \usage{ information_data_chunk(x, expand_special_chars = TRUE) } \arguments{ \item{x}{a flextable object} } \value{ a data.frame containing information about chunks: \itemize{ \item text chunk (column \code{txt}) and other content (\code{url} for the linked url, \code{eq_data} for content of type 'equation', \code{word_field_data} for content of type 'word_field' and \code{img_data} for content of type 'image'), \item formatting properties, \item part (\code{.part}), position within the paragraph (\code{.chunk_index}), row (\code{.row_id}) and column (\code{.col_id}). } } \description{ This function takes a flextable object and returns a data.frame containing information about each text chunk within the flextable. The data.frame includes details such as the text content, formatting properties, position within the paragraph, paragraph row, and column. } \section{don't use this}{ These data structures should not be used, as they represent an interpretation of the underlying data structures, which may evolve over time. \strong{They are exported to enable two packages that exploit these structures to make a transition, and should not remain available for long.} } \examples{ ft <- as_flextable(iris) x <- information_data_chunk(ft) head(x) } \seealso{ Other information data functions: \code{\link{information_data_cell}()}, \code{\link{information_data_paragraph}()} } \concept{information data functions} \keyword{internal} flextable/man/delete_part.Rd0000644000176200001440000000201714565457154015572 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{delete_part} \alias{delete_part} \title{Delete flextable part} \usage{ delete_part(x, part = "header") } \arguments{ \item{x}{a \code{flextable} object} \item{part}{partname of the table to delete (one of 'body', 'header' or 'footer').} } \description{ indicate to not print a part of the flextable, i.e. an header, footer or the body. } \examples{ ft <- flextable(head(iris)) ft <- delete_part(x = ft, part = "header") ft } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/vline_right.Rd0000644000176200001440000000235714565457154015623 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{vline_right} \alias{vline_right} \title{Set flextable right vertical borders} \usage{ vline_right(x, i = NULL, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying vertical borders to the right side of one or all parts of a flextable. The line is the right border of selected cells of the last column. } \examples{ library(officer) std_border <- fp_border(color = "orange") ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add vertical border on the left side of the table ft <- vline_right(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()} } \concept{borders management} flextable/man/as_flextable.data.frame.Rd0000644000176200001440000000373014565457153017736 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/df_printer.R \name{as_flextable.data.frame} \alias{as_flextable.data.frame} \title{Transform and summarise a 'data.frame' into a flextable Simple summary of a data.frame as a flextable} \usage{ \method{as_flextable}{data.frame}( x, max_row = 10, split_colnames = FALSE, short_strings = FALSE, short_size = 35, short_suffix = "...", do_autofit = TRUE, show_coltype = TRUE, color_coltype = "#999999", ... ) } \arguments{ \item{x}{a data.frame} \item{max_row}{The number of rows to print. Default to 10.} \item{split_colnames}{Should the column names be split (with non alpha-numeric characters). Default to FALSE.} \item{short_strings}{Should the character column be shorten. Default to FALSE.} \item{short_size}{Maximum length of character column if \code{short_strings} is TRUE. Default to 35.} \item{short_suffix}{Suffix to add when character values are shorten. Default to "...".} \item{do_autofit}{Use \code{\link[=autofit]{autofit()}} before rendering the table. Default to TRUE.} \item{show_coltype}{Show column types. Default to TRUE.} \item{color_coltype}{Color to use for column types. Default to "#999999".} \item{...}{unused arguments} } \description{ It displays the first rows and shows the column types. If there is only one row, a simplified vertical table is produced. } \examples{ as_flextable(mtcars) } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/as_flextable.merMod.Rd0000644000176200001440000000357314565457153017164 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.merMod} \alias{as_flextable.merMod} \alias{as_flextable.lme} \alias{as_flextable.gls} \alias{as_flextable.nlme} \alias{as_flextable.brmsfit} \alias{as_flextable.glmmTMB} \alias{as_flextable.glmmadmb} \title{Transform a mixed model into a flextable} \usage{ \method{as_flextable}{merMod}(x, add.random = TRUE, ...) \method{as_flextable}{lme}(x, add.random = TRUE, ...) \method{as_flextable}{gls}(x, add.random = TRUE, ...) \method{as_flextable}{nlme}(x, add.random = TRUE, ...) \method{as_flextable}{brmsfit}(x, add.random = TRUE, ...) \method{as_flextable}{glmmTMB}(x, add.random = TRUE, ...) \method{as_flextable}{glmmadmb}(x, add.random = TRUE, ...) } \arguments{ \item{x}{a mixed model} \item{add.random}{TRUE or FALSE, if TRUE random effects are added to the table.} \item{...}{unused argument} } \description{ produce a flextable describing a mixed model. The function is only using package 'broom.mixed' that provides the data presented in the resulting flextable. You can remove significance stars by setting options \code{options(show.signif.stars = FALSE)}. } \examples{ if (require("broom.mixed") && require("nlme")) { m1 <- lme(distance ~ age, data = Orthodont) ft <- as_flextable(m1) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/get_flextable_defaults.Rd0000644000176200001440000000155214565457154020001 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{get_flextable_defaults} \alias{get_flextable_defaults} \title{Get flextable defaults formatting properties} \usage{ get_flextable_defaults() } \value{ a list containing default values. } \description{ The current formatting properties are automatically applied to every flextable you produce. These default values are returned by this function. } \examples{ get_flextable_defaults() } \seealso{ Other functions related to themes: \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/hrule.Rd0000644000176200001440000000273314364612403014411 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{hrule} \alias{hrule} \title{Set flextable rule for rows heights} \usage{ hrule(x, i = NULL, rule = "auto", part = "body") } \arguments{ \item{x}{flextable object} \item{i}{rows selection} \item{rule}{specify the meaning of the height. Possible values are "atleast" (height should be at least the value specified), "exact" (height should be exactly the value specified), or the default value "auto" (height is determined based on the height of the contents, so the value is ignored).} \item{part}{partname of the table, one of "all", "header", "body", "footer"} } \description{ control rules of each height for a part of the flextable, this is only for Word and PowerPoint outputs, it will not have any effect when output is HTML or PDF. For PDF see the \code{ft.arraystretch} chunk option. } \examples{ ft_1 <- flextable(head(iris)) ft_1 <- width(ft_1, width = 1.5) ft_1 <- height(ft_1, height = 0.75, part = "header") ft_1 <- hrule(ft_1, rule = "exact", part = "header") ft_1 ft_2 <- hrule(ft_1, rule = "auto", part = "header") ft_2 } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/colformat_char.Rd0000644000176200001440000000206414565457153016266 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_char} \alias{colformat_char} \title{Format character cells} \usage{ colformat_char( x, i = NULL, j = NULL, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format character cells in a flextable. } \examples{ dat <- iris z <- flextable(head(dat)) ft <- colformat_char( x = z, j = "Species", suffix = "!" ) z <- autofit(z) z } \seealso{ Other cells formatters: \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/save_as_rtf.Rd0000644000176200001440000000362314515040463015564 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{save_as_rtf} \alias{save_as_rtf} \title{Save flextable objects in an 'RTF' file} \usage{ save_as_rtf(..., values = NULL, path, pr_section = NULL) } \arguments{ \item{...}{flextable objects, objects, possibly named. If named objects, names are used as titles.} \item{values}{a list (possibly named), each element is a flextable object. If named objects, names are used as titles. If provided, argument \code{...} will be ignored.} \item{path}{Word file to be created} \item{pr_section}{a \link{prop_section} object that can be used to define page layout such as orientation, width and height.} } \value{ a string containing the full name of the generated file } \description{ sugar function to save flextable objects in an 'RTF' file. } \examples{ tf <- tempfile(fileext = ".rtf") library(officer) ft1 <- flextable(head(iris)) save_as_rtf(ft1, path = tf) ft2 <- flextable(head(mtcars)) sect_properties <- prop_section( page_size = page_size( orient = "landscape", width = 8.3, height = 11.7 ), type = "continuous", page_margins = page_mar(), header_default = block_list( fpar(ftext("text for default page header")), qflextable(data.frame(a = 1L)) ) ) tf <- tempfile(fileext = ".rtf") save_as_rtf( `iris table` = ft1, `mtcars table` = ft2, path = tf, pr_section = sect_properties ) } \seealso{ \code{\link[=paginate]{paginate()}} Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/padding.Rd0000644000176200001440000000353314570570460014704 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{padding} \alias{padding} \title{Set paragraph paddings} \usage{ padding( x, i = NULL, j = NULL, padding = NULL, padding.top = NULL, padding.bottom = NULL, padding.left = NULL, padding.right = NULL, part = "body" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{padding}{padding (shortcut for top, bottom, left and right), unit is pts (points).} \item{padding.top}{padding top, unit is pts (points).} \item{padding.bottom}{padding bottom, unit is pts (points).} \item{padding.left}{padding left, unit is pts (points).} \item{padding.right}{padding right, unit is pts (points).} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change paddings of selected rows and columns of a flextable. } \note{ Padding is not implemented in PDF due to technical infeasibility but it can be replaced with \code{set_table_properties(opts_pdf = list(tabcolsep = 1))}. } \examples{ ft_1 <- flextable(head(iris)) ft_1 <- theme_vader(ft_1) ft_1 <- padding(ft_1, padding.top = 4, part = "all") ft_1 <- padding(ft_1, j = 1, padding.right = 40) ft_1 <- padding(ft_1, i = 3, padding.top = 40) ft_1 <- padding(ft_1, padding.top = 10, part = "header") ft_1 <- padding(ft_1, padding.bottom = 10, part = "header") ft_1 <- autofit(ft_1) ft_1 } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/vline_left.Rd0000644000176200001440000000235214565457154015433 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{vline_left} \alias{vline_left} \title{Set flextable left vertical borders} \usage{ vline_left(x, i = NULL, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying vertical borders to the left side of one or all parts of a flextable. The line is the left border of selected cells of the first column. } \examples{ library(officer) std_border <- fp_border(color = "orange") ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add vertical border on the left side of the table ft <- vline_left(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/as_flextable.summarizor.Rd0000644000176200001440000000263714565457153020151 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{as_flextable.summarizor} \alias{as_flextable.summarizor} \title{Transform a 'summarizor' object into a flextable} \usage{ \method{as_flextable}{summarizor}(x, ...) } \arguments{ \item{x}{result from \code{\link[=summarizor]{summarizor()}}} \item{...}{arguments for \code{\link[=as_flextable.tabulator]{as_flextable.tabulator()}}} } \description{ \code{summarizor} object should be transformed into a flextable with method \code{\link[=as_flextable]{as_flextable()}}. } \examples{ \dontshow{ data.table::setDTthreads(1) } z <- summarizor(CO2[-c(1, 4)], by = "Treatment", overall_label = "Overall" ) ft_1 <- as_flextable(z, spread_first_col = TRUE) ft_1 <- prepend_chunks(ft_1, i = ~ is.na(variable), j = 1, as_chunk("\t") ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/headers_flextable_at_bkm.Rd0000644000176200001440000000063414572154200020243 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/zz-defunct.R \name{headers_flextable_at_bkm} \alias{headers_flextable_at_bkm} \title{Add flextable at a bookmark location in document's header} \usage{ headers_flextable_at_bkm(...) } \arguments{ \item{...}{unused} } \description{ Function is now defunct, use \code{\link[=prop_section]{prop_section()}} instead. } \keyword{internal} flextable/man/information_data_cell.Rd0000644000176200001440000000240414552463753017615 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/read_structure.R \name{information_data_cell} \alias{information_data_cell} \title{table cell related information of a flextable} \usage{ information_data_cell(x) } \arguments{ \item{x}{a flextable object} } \value{ a data.frame containing information about cells: \itemize{ \item formatting properties, \item part (\code{.part}), row (\code{.row_id}) and column (\code{.col_id}). } } \description{ This function takes a flextable object and returns a data.frame containing information about each cell within the flextable. The data.frame includes details about formatting properties and position within the row and column. } \section{don't use this}{ These data structures should not be used, as they represent an interpretation of the underlying data structures, which may evolve over time. \strong{They are exported to enable two packages that exploit these structures to make a transition, and should not remain available for long.} } \examples{ ft <- as_flextable(iris) x <- information_data_cell(ft) head(x) } \seealso{ Other information data functions: \code{\link{information_data_chunk}()}, \code{\link{information_data_paragraph}()} } \concept{information data functions} \keyword{internal} flextable/man/hline.Rd0000644000176200001440000000233414565457154014403 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{hline} \alias{hline} \title{Set horizontal borders} \usage{ hline(x, i = NULL, j = NULL, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying an horizontal border to inner content of one or all parts of a flextable. The lines are the bottom borders of selected cells. } \examples{ library(officer) std_border <- fp_border(color = "gray") ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add horizontal borders ft <- hline(ft, part = "all", border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/minibar.Rd0000644000176200001440000000355014565457154014726 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{minibar} \alias{minibar} \title{Mini barplots chunk wrapper} \usage{ minibar( value, max = NULL, barcol = "#CCCCCC", bg = "transparent", width = 1, height = 0.2, unit = "in" ) } \arguments{ \item{value}{values containing the bar size} \item{max}{max bar size} \item{barcol}{bar color} \item{bg}{background color} \item{width, height}{size of the resulting png file in inches} \item{unit}{unit for width and height, one of "in", "cm", "mm".} } \description{ This function is used to insert bars into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ ft <- flextable(head(iris, n = 10)) ft <- compose(ft, j = 1, value = as_paragraph( minibar(value = Sepal.Length, max = max(Sepal.Length)) ), part = "body" ) ft <- autofit(ft) ft } \seealso{ \code{\link[=compose]{compose()}}, \code{\link[=as_paragraph]{as_paragraph()}} Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/as_flextable.tabular.Rd0000644000176200001440000000777314565457153017401 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.tabular.R \name{as_flextable.tabular} \alias{as_flextable.tabular} \title{Transform a 'tables::tabular' object into a flextable} \usage{ \method{as_flextable}{tabular}( x, spread_first_col = FALSE, fp_p = fp_par(text.align = "center", padding.top = 4), row_title = as_paragraph(as_chunk(.row_title)), add_tab = FALSE, ... ) } \arguments{ \item{x}{object produced by \code{\link[tables:tabular]{tables::tabular()}}.} \item{spread_first_col}{if TRUE, first row is spread as a new line separator instead of being a column. This helps to reduce the width and allows for clear divisions.} \item{fp_p}{paragraph formatting properties associated with row titles, see \code{\link[=fp_par]{fp_par()}}.} \item{row_title}{a call to \code{\link[=as_paragraph]{as_paragraph()}} - it will be applied to the row titles if any when \code{spread_first_col=TRUE}.} \item{add_tab}{adds a tab in front of "list_data" label lines (located in column \code{.type}).} \item{...}{unused argument} } \description{ Produce a flextable from a 'tabular' object produced with function \code{\link[tables:tabular]{tables::tabular()}}. When \code{as_flextable.tabular=TRUE}, the first column is used as row separator acting as a row title. It can be formated with arguments \code{fp_p} (the formatting properties of the paragraph) and \code{row_title} that specifies the content and eventually formattings of the content. Two hidden columns can be used for conditional formatting after the creation of the flextable (use only when \code{spread_first_col=TRUE}): \itemize{ \item The column \code{.row_title} that contains the title label \item The column \code{.type} that can contain the following values: \itemize{ \item "one_row": Indicates that there is only one row for this group. In this case, the row is not expanded with a title above. \item "list_title": Indicates a row that serves as a title for the data that are displayed after it. \item "list_data": Indicates rows that follow a title and contain data to be displayed. } } The result is paginated (see \code{\link[=paginate]{paginate()}}). } \examples{ if (require("tables")) { set.seed(42) genders <- c("Male", "Female") status <- c("low", "medium", "high") Sex <- factor(sample(genders, 100, rep = TRUE)) Status <- factor(sample(status, 100, rep = TRUE)) z <- rnorm(100) + 5 fmt <- function(x) { s <- format(x, digits = 2) even <- ((1:length(s)) \%\% 2) == 0 s[even] <- sprintf("(\%s)", s[even]) s } tab <- tabular( Justify(c) * Heading() * z * Sex * Heading(Statistic) * Format(fmt()) * (mean + sd) ~ Status ) as_flextable(tab) } if (require("tables")) { tab <- tabular( (Species + 1) ~ (n = 1) + Format(digits = 2) * (Sepal.Length + Sepal.Width) * (mean + sd), data = iris ) as_flextable(tab) } if (require("tables")) { x <- tabular((Factor(gear, "Gears") + 1) * ((n = 1) + Percent() + (RowPct = Percent("row")) + (ColPct = Percent("col"))) ~ (Factor(carb, "Carburetors") + 1) * Format(digits = 1), data = mtcars) ft <- as_flextable( x, spread_first_col = TRUE, row_title = as_paragraph( colorize("Gears: ", color = "#666666"), colorize(as_b(.row_title), color = "red") ) ) ft } if (require("tables")) { tab <- tabular( (mean + mean) * (Sepal.Length + Sepal.Width) ~ 1, data = iris ) as_flextable(tab) } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/summarizor.Rd0000644000176200001440000000304214476430471015503 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{summarizor} \alias{summarizor} \title{Data summary preparation} \usage{ summarizor( x, by = character(), overall_label = NULL, num_stats = c("mean_sd", "median_iqr", "range"), hide_null_na = TRUE ) } \arguments{ \item{x}{dataset} \item{by}{columns names to be used as grouping columns} \item{overall_label}{label to use as overall label} \item{num_stats}{available statistics for numerical columns to show, available options are "mean_sd", "median_iqr" and "range".} \item{hide_null_na}{if TRUE (default), NA counts will not be shown when 0.} } \description{ It performs a univariate statistical analysis of a dataset by group and formats the results so that they can be used with the \code{\link[=tabulator]{tabulator()}} function or directly with \link[=as_flextable.summarizor]{as_flextable}. \if{html}{\out{ summarizor illustration }} } \note{ This is very first version of the function; be aware it can evolve or change. } \examples{ \dontshow{ data.table::setDTthreads(1) } z <- summarizor(CO2[-c(1, 4)], by = "Treatment", overall_label = "Overall" ) ft_1 <- as_flextable(z) ft_1 ft_2 <- as_flextable(z, sep_w = 0, spread_first_col = TRUE) ft_2 z <- summarizor(CO2[-c(1, 4)]) ft_3 <- as_flextable(z, sep_w = 0, spread_first_col = TRUE) ft_3 } \seealso{ \code{\link[=fmt_summarizor]{fmt_summarizor()}}, \code{\link[=labelizor]{labelizor()}} } flextable/man/theme_vader.Rd0000644000176200001440000000376014565457154015573 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_vader} \alias{theme_vader} \title{Apply Sith Lord Darth Vader theme} \usage{ theme_vader(x, ...) } \arguments{ \item{x}{a flextable object} \item{...}{unused} } \description{ Apply Sith Lord Darth Vader theme to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_vader(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/grid_chunk.Rd0000644000176200001440000000353614565457154015426 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{grid_chunk} \alias{grid_chunk} \title{'Grid Graphics' chunk wrapper} \usage{ grid_chunk(value, width = 1, height = 0.2, unit = "in", res = 300) } \arguments{ \item{value}{grid objects, stored in a list column; or a list of grid objects.} \item{width, height}{size of the resulting png file} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{res}{resolution of the png image in ppi} } \description{ This function is used to insert grid objects into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ library(flextable) ft_1 <- flextable(head(cars)) if (require("grid")) { ft_1 <- prepend_chunks( x = ft_1, i = 2, j = 2, grid_chunk( list( circleGrob(gp = gpar( fill = "#ec11c2", col = "transparent" )) ), width = .15, height = .15 ) ) } ft_1 } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/bg.Rd0000644000176200001440000000450214566144245013666 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{bg} \alias{bg} \title{Set background color} \usage{ bg(x, i = NULL, j = NULL, bg, part = "body", source = j) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{bg}{color to use as background color. If a function, function need to return a character vector of colors.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} \item{source}{if bg is a function, source is specifying the dataset column to be used as argument to \code{bg}. This is only useful if j is colored with values contained in other columns.} } \description{ Change background color of selected rows and columns of a flextable. A function can be used instead of fixed colors. When \code{bg} is a function, it is possible to color cells based on values located in other columns, using hidden columns (those not used by argument \code{colkeys}) is a common use case. The argument \code{source} has to be used to define what are the columns to be used for the color definition and the argument \code{j} has to be used to define where to apply the colors and only accept values from \code{colkeys}. } \note{ Word does not allow you to apply transparency to table cells or paragraph shading. } \examples{ ft_1 <- flextable(head(mtcars)) ft_1 <- bg(ft_1, bg = "wheat", part = "header") ft_1 <- bg(ft_1, i = ~ qsec < 18, bg = "#EFEFEF", part = "body") ft_1 <- bg(ft_1, j = "drat", bg = "#606060", part = "all") ft_1 <- color(ft_1, j = "drat", color = "white", part = "all") ft_1 if (require("scales")) { ft_2 <- flextable(head(iris)) colourer <- col_numeric( palette = c("wheat", "red"), domain = c(0, 7) ) ft_2 <- bg(ft_2, j = c( "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width" ), bg = colourer, part = "body" ) ft_2 } } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/width.Rd0000644000176200001440000000240614364612403014406 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{width} \alias{width} \title{Set columns width} \usage{ width(x, j = NULL, width, unit = "in") } \arguments{ \item{x}{a \code{\link[=flextable]{flextable()}} object} \item{j}{columns selection} \item{width}{width in inches} \item{unit}{unit for width, one of "in", "cm", "mm".} } \description{ Defines the widths of one or more columns in the table. This function will have no effect if you have used \code{set_table_properties(layout = "autofit")}. \code{\link[=set_table_properties]{set_table_properties()}} can provide an alternative to fixed-width layouts that is supported with HTML and Word output that can be set with \code{set_table_properties(layout = "autofit")}. } \details{ Heights are not used when flextable is been rendered into HTML. } \examples{ ft <- flextable(head(iris)) ft <- width(ft, width = 1.5) ft } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()} } \concept{flextable dimensions} flextable/man/fmt_header_n.Rd0000644000176200001440000000176514570173724015720 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_header_n} \alias{fmt_header_n} \title{Format count data for headers} \usage{ fmt_header_n(n, newline = TRUE) } \arguments{ \item{n}{count values} \item{newline}{indicates to prefix the text with a new line (sof return).} } \description{ The function formats counts as \verb{\\n(N=XX)}. This helper function is used to add counts in columns titles. } \examples{ library(flextable) df <- data.frame(zz = 1) ft_1 <- flextable(df) ft_1 <- append_chunks( x = ft_1, j = 1, part = "header", value = as_chunk(fmt_header_n(200)) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/flextable_dim.Rd0000644000176200001440000000200314552302465016062 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{flextable_dim} \alias{flextable_dim} \title{Get width and height of a flextable object} \usage{ flextable_dim(x, unit = "in") } \arguments{ \item{x}{a flextable object} \item{unit}{unit for returned values, one of "in", "cm", "mm".} } \description{ Returns the width, height and aspect ratio of a flextable in a named list. The aspect ratio is the ratio corresponding to \code{height/width}. Names of the list are \code{widths}, \code{heights} and \code{aspect_ratio}. } \examples{ ftab <- flextable(head(iris)) flextable_dim(ftab) ftab <- autofit(ftab) flextable_dim(ftab) } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/set_header_labels.Rd0000644000176200001440000000354514565457154016736 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{set_header_labels} \alias{set_header_labels} \title{Change headers labels} \usage{ set_header_labels(x, ..., values = NULL) } \arguments{ \item{x}{a \code{flextable} object} \item{...}{named arguments (names are data colnames), each element is a single character value specifying label to use.} \item{values}{a named list (names are data colnames), each element is a single character value specifying label to use. If provided, argument \code{...} will be ignored. It can also be a unamed character vector, in that case, it must have the same length than the number of columns of the flextable.} } \description{ This function set labels for specified columns in the bottom row header of a flextable. } \examples{ ft <- flextable(head(iris)) ft <- set_header_labels(ft, Sepal.Length = "Sepal length", Sepal.Width = "Sepal width", Petal.Length = "Petal length", Petal.Width = "Petal width" ) ft <- flextable(head(iris)) ft <- set_header_labels(ft, values = list( Sepal.Length = "Sepal length", Sepal.Width = "Sepal width", Petal.Length = "Petal length", Petal.Width = "Petal width" ) ) ft ft <- flextable(head(iris)) ft <- set_header_labels( x = ft, values = c( "Sepal length", "Sepal width", "Petal length", "Petal width", "Species") ) ft } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}} } \concept{functions for row and column operations in a flextable} flextable/man/nrow_part.Rd0000644000176200001440000000146014021743006015273 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/nrowcol.R \name{nrow_part} \alias{nrow_part} \title{Number of rows of a part} \usage{ nrow_part(x, part = "body") } \arguments{ \item{x}{flextable object} \item{part}{partname of the table (one of 'body', 'header', 'footer')} } \description{ returns the number of lines in a part of flextable. } \examples{ library(flextable) ft <- qflextable(head(cars)) nrow_part(ft, part = "body") } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/set_caption.Rd0000644000176200001440000002313514476430471015610 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable.R \name{set_caption} \alias{set_caption} \title{Set Caption} \usage{ set_caption( x, caption = NULL, autonum = NULL, word_stylename = "Table Caption", style = word_stylename, fp_p = fp_par(padding = 3), align_with_table = TRUE, html_classes = NULL, html_escape = TRUE ) } \arguments{ \item{x}{flextable object} \item{caption}{caption value. The caption can be either a string either a call to \code{\link[=as_paragraph]{as_paragraph()}}. In the latter case, users are free to format the caption with colors, italic fonts, also mixed with images or equations. Note that Quarto does not allow the use of this feature. Caption as a string does not support 'Markdown' syntax. If you want to add a bold text in the caption, use \code{as_paragraph('a ', as_b('bold'), ' text')} when providing caption.} \item{autonum}{an autonum representation. See \code{\link[officer:run_autonum]{officer::run_autonum()}}. This has an effect only when the output is "Word" (in which case the object is used to define the Word auto-numbering), "html" and "pdf" (in which case only the bookmark identifier will be used). If used, the caption is preceded by an auto-number sequence.} \item{word_stylename, style}{'Word' style name to associate with caption paragraph. These names are available with function \code{\link[officer:styles_info]{officer::styles_info()}} when output is Word. Argument \code{style} is deprecated in favor of \code{word_stylename}. If the caption is defined with \code{as_paragraph()}, some of the formattings of the paragraph style will be replaced by the formattings associated with the chunks (such as the font).} \item{fp_p}{paragraph formatting properties associated with the caption, see \code{\link[=fp_par]{fp_par()}}. It applies when possible, i.e. in HTML and 'Word' but not with bookdown.} \item{align_with_table}{if TRUE, caption is aligned as the flextable, if FALSE, \code{fp_p} will not be updated and alignement is as defined with \code{fp_p}. It applies when possible, i.e. in HTML and 'Word' but not with bookdown.} \item{html_classes}{css class(es) to apply to associate with caption paragraph when output is 'Word'.} \item{html_escape}{should HTML entities be escaped so that it can be safely included as text or an attribute value within an HTML document.} } \description{ Set caption value in a flextable. The function can also be used to define formattings that will be applied if possible to Word and HTML outputs. \itemize{ \item The caption will be associated with a paragraph style when the output is Word. It can also be numbered as a auto-numbered Word computed value. \item The PowerPoint format ignores captions. PowerPoint documents are not structured and do not behave as HTML documents and paginated documents (word, pdf), and it's not possible to know where we should create a shape to contain the caption (technically it can't be in the PowerPoint shape containing the table). } When working with 'R Markdown' or 'Quarto', the caption settings defined with \code{set_caption()} will be prioritized over knitr chunk options. Caption value can be a single string or the result to a call to \code{\link[=as_paragraph]{as_paragraph()}}. With the latter, the caption is made of formatted chunks whereas with the former, caption will not be associated with any formatting. } \details{ The behavior of captions in the 'flextable' package varies depending on the formats and technologies used. The values set by the \code{set_caption()} function will be prioritized whenever possible, including the caption ID and associated paragraph style. However, it's important to note that the behavior may differ across different tools. Here's what we have observed and attempted to respect, but please inform us if you believe our observations are incorrect: \itemize{ \item In Word and HTML documents created with 'rmarkdown' \code{rmarkdown::word_document()} and \code{rmarkdown::html_document()}, numbered and cross-referenced captions are not typically expected. \item In PDF documents created with 'rmarkdown' \code{rmarkdown::pdf_document()}, numbers are automatically added before the caption. \item In Word and HTML documents created with 'bookdown', numbered and cross-referenced captions are expected. 'bookdown' handles this functionality, but due to technical reasons, the caption should not be defined within an HTML or XML block. Therefore, when using 'flextable', the ability to format the caption content is lost (this limitation does not apply to PDF documents). \item HTML and PDF documents created with Quarto handle captions and cross-references differently. Quarto replaces captions with 'tbl-cap' and 'label' values. \item Word documents created with Quarto present another specific case. Currently, Quarto does not inject captions using the 'tbl-cap' and label values. However, this is a temporary situation that is expected to change in the future. The 'flextable' package will adapt accordingly as Quarto evolves. \item When using the \code{body_add_flextable()} function, all the options specified with \code{set_caption()} will be enabled. } Using \code{\link[=body_add_flextable]{body_add_flextable()}} enable all options specified with \code{set_caption()}. } \section{R Markdown}{ flextable captions can be defined from R Markdown documents by using \code{knitr::opts_chunk$set()}. User don't always have to call \code{set_caption()} to set a caption, he can use knitr chunk options instead. A typical call would be: \if{html}{\out{
}}\preformatted{```\{r\} #| tab.id: bookmark_id #| tab.cap: caption text flextable(head(cars)) ``` }\if{html}{\out{
}} \code{tab.id} is the caption id or bookmark, \code{tab.cap} is the caption text. There are many options that can replace \code{set_caption()} features. The following knitr chunk options are available:\tabular{lcc}{ \strong{label} \tab \strong{name} \tab \strong{value} \cr Word stylename to use for table captions. \tab tab.cap.style \tab NULL \cr caption id/bookmark \tab tab.id \tab NULL \cr caption \tab tab.cap \tab NULL \cr display table caption on top of the table or not \tab tab.topcaption \tab TRUE \cr caption table sequence identifier. \tab tab.lp \tab "tab:" \cr prefix for numbering chunk (default to "Table "). \tab tab.cap.pre \tab Table \cr suffix for numbering chunk (default to ": "). \tab tab.cap.sep \tab " :" \cr title number depth \tab tab.cap.tnd \tab 0 \cr separator to use between title number and table number. \tab tab.cap.tns \tab "-" \cr caption prefix formatting properties \tab tab.cap.fp_text \tab fp_text_lite(bold = TRUE) \cr } See \link{knit_print.flextable} for more details. } \section{Formatting the caption}{ To create captions in R Markdown using the 'flextable' package and 'officer' package, you can utilize the \code{as_paragraph()} function. This approach is recommended when your captions require complex content, such as a combination of different text styles or the inclusion of images and equations. The caption is constructed as a paragraph consisting of multiple chunks. Each chunk represents a specific portion of the caption with its desired formatting, such as red bold text or Arial italic text. By default, if no specific formatting is specified (using either "a string" or \code{as_chunk("a string")}), the \code{fp_text_default()} function sets the font settings for the caption, including the font family, boldness, italics, color, etc. The default values can be modified using the \code{set_flextable_defaults()} function. However, it is recommended to explicitly use \code{as_chunk()} to define the desired formatting. It's important to note that the style properties of the caption will not override the formatting of the individual elements within it. Therefore, you need to explicitly specify the font to be used for the caption. Here's an example of how to set a caption for a flextable in R Markdown using the 'officer' package: \if{html}{\out{
}}\preformatted{library(flextable) library(officer) ftab <- flextable(head(cars)) \%>\% set_caption( as_paragraph( as_chunk("caption", props = fp_text_default(font.family = "Cambria")) ), word_stylename = "Table Caption" ) print(ftab, preview = "docx") }\if{html}{\out{
}} In this example, the \code{set_caption()} function sets the caption for the flextable. The caption is created using \code{as_paragraph()} with a single chunk created using \code{as_chunk("caption", props = fp_text_default(font.family = "Cambria"))}. The \code{word_stylename} parameter is used to specify the table caption style in the resulting Word document. Finally, the \code{print()} function generates the flextable with the caption, and \code{preview = "docx"} displays a preview of the resulting Word document. } \section{Using 'Quarto'}{ In 'Quarto', captions and cross-references are handled differently compared to 'R Markdown', where flextable takes care of the job. In Quarto, the responsibility for managing captions lies with the Quarto framework itself. Consequently, the \code{set_caption()} function in 'flextable' is not as useful in a 'Quarto' document. The formatting and numbering of captions are determined by Quarto rather than flextable. Please refer to the Quarto documentation for more information on how to work with captions in Quarto. } \examples{ ftab <- flextable(head(iris)) ftab <- set_caption(ftab, "my caption") ftab library(officer) autonum <- run_autonum(seq_id = "tab", bkm = "mtcars") ftab <- flextable(head(mtcars)) ftab <- set_caption(ftab, caption = "mtcars data", autonum = autonum) ftab } \seealso{ \code{\link[=flextable]{flextable()}} } flextable/man/merge_v.Rd0000644000176200001440000000423414565457154014731 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/merge_flextable.R \name{merge_v} \alias{merge_v} \title{Merge flextable cells vertically} \usage{ merge_v(x, j = NULL, target = NULL, part = "body", combine = FALSE) } \arguments{ \item{x}{\code{flextable} object} \item{j}{column to used to find consecutive values to be merged. Columns from orignal dataset can also be used.} \item{target}{columns names where cells have to be merged.} \item{part}{partname of the table where merge has to be done.} \item{combine}{If the value is TRUE, the columns defined by \code{j} will be combined into a single column/value and the consecutive values of this result will be used. Otherwise, the columns are inspected one by one to perform cell merges.} } \description{ Merge flextable cells vertically when consecutive cells have identical values. Text of formatted values are used to compare values if available. Two options are available, either a column-by-column algorithm or an algorithm where the combinations of these columns are used once for all target columns. } \examples{ ft_merge <- flextable(mtcars) ft_merge <- merge_v(ft_merge, j = c("gear", "carb")) ft_merge data_ex <- structure(list(srdr_id = c( "175124", "175124", "172525", "172525", "172545", "172545", "172609", "172609", "172609" ), substances = c( "alcohol", "alcohol", "alcohol", "alcohol", "cannabis", "cannabis", "alcohol\n cannabis\n other drugs", "alcohol\n cannabis\n other drugs", "alcohol\n cannabis\n other drugs" ), full_name = c( "TAU", "MI", "TAU", "MI (parent)", "TAU", "MI", "TAU", "MI", "MI" ), article_arm_name = c( "Control", "WISEteens", "Treatment as usual", "Brief MI (b-MI)", "Assessed control", "Intervention", "Control", "Computer BI", "Therapist BI" )), row.names = c( NA, -9L ), class = c("tbl_df", "tbl", "data.frame")) ft_1 <- flextable(data_ex) ft_1 <- theme_box(ft_1) ft_2 <- merge_v(ft_1, j = "srdr_id", target = c("srdr_id", "substances") ) ft_2 } \seealso{ Other flextable merging function: \code{\link{merge_at}()}, \code{\link{merge_h}()}, \code{\link{merge_h_range}()}, \code{\link{merge_none}()} } \concept{flextable merging function} flextable/man/before.Rd0000644000176200001440000000213514476430471014537 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{before} \alias{before} \title{Is an element before a match with entries} \usage{ before(x, entries) } \arguments{ \item{x}{an atomic vector of values to be tested} \item{entries}{a sequence of items to be searched in \code{x}.} } \description{ return a logical vector of the same length as x, indicating if elements are located before a set of entries to match or not. } \examples{ library(flextable) library(officer) dat <- data.frame( stringsAsFactors = FALSE, check.names = FALSE, Level = c("setosa", "versicolor", "virginica", "", "Total"), Freq = as.integer(c(50, 50, 50, 0, 150)), `\% Valid` = c( 100 / 3, 100 / 3, 100 / 3, NA, 100 ), `\% Valid Cum.` = c(100 / 3, 100 * 2 / 3, 100, NA, 100), `\% Total` = c( 100 / 3, 100 / 3, 100 / 3, 0, 100 ), `\% Total Cum.` = c( 100 / 3, 100 * 2 / 3, 100, 100, 100 ) ) ft <- flextable(dat) ft <- hline(ft, i = ~ before(Level, "Total"), border = fp_border_default(width = 2) ) ft } \seealso{ \code{\link[=hline]{hline()}} } flextable/man/plot.flextable.Rd0000644000176200001440000000316714600642405016215 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{plot.flextable} \alias{plot.flextable} \title{Plot a flextable} \usage{ \method{plot}{flextable}(x, ...) } \arguments{ \item{x}{a flextable object} \item{...}{additional arguments passed to \code{\link[=gen_grob]{gen_grob()}}.} } \description{ plots a flextable as a grid grob object and display the result in a new graphics window. 'ragg' or 'svglite' or 'ggiraph' graphical device drivers should be used to ensure a correct rendering. } \section{caption}{ It's important to note that captions are not part of the table itself. This means when exporting a table to PNG or SVG formats (image formats), the caption won't be included. Captions are intended for document outputs like Word, HTML, or PDF, where tables are embedded within the document itself. } \examples{ library(gdtools) library(ragg) register_liberationsans() set_flextable_defaults(font.family = "Liberation Sans") ftab <- as_flextable(cars) tf <- tempfile(fileext = ".png") agg_png( filename = tf, width = 1.7, height = 3.26, unit = "in", background = "transparent", res = 150 ) plot(ftab) dev.off() } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/fit_to_width.Rd0000644000176200001440000000205214470463166015757 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{fit_to_width} \alias{fit_to_width} \title{Fit a flextable to a maximum width} \usage{ fit_to_width(x, max_width, inc = 1L, max_iter = 20, unit = "in") } \arguments{ \item{x}{flextable object} \item{max_width}{maximum width to fit in inches} \item{inc}{the font size decrease for each step} \item{max_iter}{maximum iterations} \item{unit}{unit for max_width, one of "in", "cm", "mm".} } \description{ decrease font size for each cell incrementally until it fits a given max_width. } \examples{ ft_1 <- qflextable(head(mtcars)) ft_1 <- width(ft_1, width = 1) ft_1 ft_2 <- fit_to_width(ft_1, max_width = 4) ft_2 } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/chunk_dataframe.Rd0000644000176200001440000000444314375473105016414 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{chunk_dataframe} \alias{chunk_dataframe} \title{Create a chunk representation suitable for flextable} \usage{ chunk_dataframe(...) } \arguments{ \item{...}{values to set.} } \value{ a data.frame with an additional class "chunk" that makes it suitable for beeing used in \code{\link[=as_paragraph]{as_paragraph()}} } \description{ This function is to be used by external packages that want to provide an object that can be inserted as a chunk object in paragraphs of a flextable object. } \section{text pattern with default values}{ \if{html}{\out{
}}\preformatted{chunk_dataframe(txt = c("any text", "other text")) }\if{html}{\out{
}} } \section{text pattern with bold set to TRUE}{ \if{html}{\out{
}}\preformatted{chunk_dataframe( txt = c("any text", "other text"), bold = c(TRUE, TRUE)) }\if{html}{\out{
}} } \section{text pattern with control over all formatting properties}{ \if{html}{\out{
}}\preformatted{chunk_dataframe( txt = c("any text", "other text"), font.size = c(12, 10), italic = c(FALSE, TRUE), bold = c(FALSE, TRUE), underlined = c(FALSE, TRUE), color = c("black", "red"), shading.color = c("transparent", "yellow"), font.family = c("Arial", "Arial"), hansi.family = c("Arial", "Arial"), eastasia.family = c("Arial", "Arial"), cs.family = c("Arial", "Arial"), vertical.align = c("top", "bottom") ) }\if{html}{\out{
}} } \section{text with url pattern}{ \if{html}{\out{
}}\preformatted{chunk_dataframe( txt = c("any text", "other text"), url = rep("https://www.google.fr", 2), font.size = c(12, 10), italic = c(FALSE, TRUE), bold = c(FALSE, TRUE), underlined = c(FALSE, TRUE), color = c("black", "red"), shading.color = c("transparent", "yellow"), font.family = c("Arial", "Arial"), hansi.family = c("Arial", "Arial"), eastasia.family = c("Arial", "Arial"), cs.family = c("Arial", "Arial"), vertical.align = c("top", "bottom") ) }\if{html}{\out{
}} } \section{images pattern}{ \if{html}{\out{
}}\preformatted{chunk_dataframe(width = width, height = height, img_data = files ) }\if{html}{\out{
}} } \keyword{internal} flextable/man/colformat_int.Rd0000644000176200001440000000222114565457154016137 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_int} \alias{colformat_int} \title{Format integer cells} \usage{ colformat_int( x, i = NULL, j = NULL, big.mark = get_flextable_defaults()$big.mark, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{big.mark}{see \code{\link[=format]{format()}}} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format integer cells in a flextable. } \examples{ z <- flextable(head(mtcars)) j <- c("vs", "am", "gear", "carb") z <- colformat_int(x = z, j = j, prefix = "# ") z } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/bold.Rd0000644000176200001440000000200014566144245014205 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{bold} \alias{bold} \title{Set bold font} \usage{ bold(x, i = NULL, j = NULL, bold = TRUE, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{bold}{boolean value} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change font weight of selected rows and columns of a flextable. } \examples{ ft <- flextable(head(iris)) ft <- bold(ft, bold = TRUE, part = "header") } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/as_raster.Rd0000644000176200001440000000250614515040434015250 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{as_raster} \alias{as_raster} \title{Transform a flextable into a raster} \usage{ as_raster(x, ...) } \arguments{ \item{x}{a flextable object} \item{...}{additional arguments passed to other functions} } \description{ save a flextable as an image and return the corresponding raster. This function has been implemented to let flextable be printed on a ggplot object. The function is no longer very useful since \code{\link[=gen_grob]{gen_grob()}} exists and will be deprecated in a future version. } \note{ This function requires package 'magick'. } \examples{ ft <- qflextable(head(mtcars)) \dontrun{ if (require("ggplot2") && require("magick")) { print(qplot(speed, dist, data = cars, geom = "point")) grid::grid.raster(as_raster(ft)) } } } \seealso{ Other flextable print function: \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} \keyword{internal} flextable/man/fmt_pct.Rd0000644000176200001440000000155314570173725014735 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_pct} \alias{fmt_pct} \title{Format numerical data as percentages} \usage{ fmt_pct(x) } \arguments{ \item{x}{numeric values} } \description{ The function formats numeric vectors as percentages. } \examples{ library(flextable) df <- data.frame(zz = .45) ft_1 <- flextable(df) ft_1 <- mk_par( x = ft_1, j = 1, part = "body", value = as_paragraph(as_chunk(zz, formatter = fmt_pct)) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/as_flextable.tabulator.Rd0000644000176200001440000000704014565457153017727 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable_tabulator.R \name{as_flextable.tabulator} \alias{as_flextable.tabulator} \title{Transform a 'tabulator' object into a flextable} \usage{ \method{as_flextable}{tabulator}( x, separate_with = character(0), big_border = fp_border_default(width = 1.5), small_border = fp_border_default(width = 0.75), rows_alignment = "left", columns_alignment = "center", label_rows = x$rows, spread_first_col = FALSE, expand_single = FALSE, sep_w = 0.05, unit = "in", ... ) } \arguments{ \item{x}{result from \code{\link[=tabulator]{tabulator()}}} \item{separate_with}{columns used to sepatate the groups with an horizontal line.} \item{big_border, small_border}{big and small border properties defined by a call to \code{\link[=fp_border_default]{fp_border_default()}} or \code{\link[=fp_border]{fp_border()}}.} \item{rows_alignment, columns_alignment}{alignments to apply to columns corresponding to \code{rows} and \code{columns}; see arguments \code{rows} and \code{columns} in \code{\link[=tabulator]{tabulator()}}.} \item{label_rows}{labels to use for the first column names, i.e. the \emph{row} column names. It must be a named vector, the values will be matched based on the names.} \item{spread_first_col}{if TRUE, first row is spread as a new line separator instead of being a column. This helps to reduce the width and allows for clear divisions.} \item{expand_single}{if FALSE (the default), groups with only one row will not be expanded with a title row. If TRUE, single row groups and multi-row groups are all restructured.} \item{sep_w}{blank column separators'width to be used. If 0, blank column separators will not be used.} \item{unit}{unit of argument \code{sep_w}, one of "in", "cm", "mm".} \item{...}{unused argument} } \description{ \code{\link[=tabulator]{tabulator()}} object can be transformed as a flextable with method \code{\link[=as_flextable]{as_flextable()}}. } \examples{ \dontrun{ library(flextable) set_flextable_defaults(digits = 2, border.color = "gray") if (require("stats")) { dat <- aggregate(breaks ~ wool + tension, data = warpbreaks, mean ) cft_1 <- tabulator( x = dat, rows = "wool", columns = "tension", `mean` = as_paragraph(as_chunk(breaks)), `(N)` = as_paragraph( as_chunk(length(breaks)) ) ) ft_1 <- as_flextable(cft_1, sep_w = .1) ft_1 } if (require("stats")) { set_flextable_defaults( padding = 1, font.size = 9, border.color = "orange" ) ft_2 <- as_flextable(cft_1, sep_w = 0) ft_2 } if (require("stats")) { set_flextable_defaults( padding = 6, font.size = 11, border.color = "white", font.color = "white", background.color = "#333333" ) ft_3 <- as_flextable( x = cft_1, sep_w = 0, rows_alignment = "center", columns_alignment = "right" ) ft_3 } init_flextable_defaults() } } \seealso{ \code{\link[=summarizor]{summarizor()}}, \code{\link[=as_grouped_data]{as_grouped_data()}} Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/continuous_summary.Rd0000644000176200001440000000154014476430470017256 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{continuous_summary} \alias{continuous_summary} \title{Continuous columns summary} \usage{ continuous_summary( dat, columns = NULL, by = character(0), hide_grouplabel = TRUE, digits = 3 ) } \arguments{ \item{dat}{a data.frame} \item{columns}{continuous variables to be summarized. If NULL all continuous variables are summarized.} \item{by}{discrete variables to use as groups when summarizing.} \item{hide_grouplabel}{if TRUE, group label will not be rendered, only level/value will be rendered.} \item{digits}{the desired number of digits after the decimal point} } \description{ create a data.frame summary for continuous variables } \examples{ ft_1 <- continuous_summary(iris, names(iris)[1:4], by = "Species", hide_grouplabel = FALSE ) ft_1 } flextable/man/save_as_pptx.Rd0000644000176200001440000000334014515040463015760 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{save_as_pptx} \alias{save_as_pptx} \title{Save flextable objects in a 'PowerPoint' file} \usage{ save_as_pptx(..., values = NULL, path) } \arguments{ \item{...}{flextable objects, objects, possibly named. If named objects, names are used as slide titles.} \item{values}{a list (possibly named), each element is a flextable object. If named objects, names are used as slide titles. If provided, argument \code{...} will be ignored.} \item{path}{PowerPoint file to be created} } \value{ a string containing the full name of the generated file } \description{ sugar function to save flextable objects in an PowerPoint file. This feature is available to simplify the work of users by avoiding the need to use the 'officer' package. If it doesn't suit your needs, then use the API offered by 'officer' which allows simple and complicated things. } \note{ The PowerPoint format ignores captions (see \code{\link[=set_caption]{set_caption()}}). } \examples{ ft1 <- flextable(head(iris)) tf <- tempfile(fileext = ".pptx") save_as_pptx(ft1, path = tf) ft2 <- flextable(head(mtcars)) tf <- tempfile(fileext = ".pptx") save_as_pptx(`iris table` = ft1, `mtcars table` = ft2, path = tf) } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/compose.Rd0000644000176200001440000000501014476430471014735 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/compose.R \name{compose} \alias{compose} \alias{mk_par} \title{Define displayed values and mixed content} \usage{ compose(x, i = NULL, j = NULL, value, part = "body", use_dot = FALSE) mk_par(x, i = NULL, j = NULL, value, part = "body", use_dot = FALSE) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{column selection} \item{value}{a call to function \code{\link[=as_paragraph]{as_paragraph()}}.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} \item{use_dot}{by default \code{use_dot=FALSE}; if \code{use_dot=TRUE}, \code{value} is evaluated within a data.frame augmented of a column named \code{.} containing the \code{j}th column.} } \description{ Modify flextable displayed values with eventually mixed content paragraphs. Function is handling complex formatting as image insertion with \code{\link[=as_image]{as_image()}}, superscript with \code{\link[=as_sup]{as_sup()}}, formated text with \code{\link[=as_chunk]{as_chunk()}} and several other \emph{chunk} functions. Function \code{mk_par} is another name for \code{compose} as there is an unwanted \strong{conflict with package 'purrr'}. If you only need to add some content at the end or the beginning of paragraphs and keep existing content as it is, functions \code{\link[=append_chunks]{append_chunks()}} and \code{\link[=prepend_chunks]{prepend_chunks()}} should be prefered. } \examples{ ft_1 <- flextable(head(cars, n = 5), col_keys = c("speed", "dist", "comment")) ft_1 <- mk_par( x = ft_1, j = "comment", i = ~ dist > 9, value = as_paragraph( colorize(as_i("speed: "), color = "gray"), as_sup(sprintf("\%.0f", speed)) ) ) ft_1 <- set_table_properties(ft_1, layout = "autofit") ft_1 # using `use_dot = TRUE` ---- set.seed(8) dat <- iris[sample.int(n = 150, size = 10), ] dat <- dat[order(dat$Species), ] ft_2 <- flextable(dat) ft_2 <- mk_par(ft_2, j = ~ . - Species, value = as_paragraph( minibar(., barcol = "white", height = .1 ) ), use_dot = TRUE ) ft_2 <- theme_vader(ft_2) ft_2 <- autofit(ft_2) ft_2 } \seealso{ \code{\link[=fp_text_default]{fp_text_default()}}, \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=as_b]{as_b()}}, \code{\link[=as_word_field]{as_word_field()}}, \code{\link[=labelizor]{labelizor()}} Other functions for mixed content paragraphs: \code{\link{append_chunks}()}, \code{\link{as_paragraph}()}, \code{\link{prepend_chunks}()} } \concept{functions for mixed content paragraphs} flextable/man/line_spacing.Rd0000644000176200001440000000223614566144245015733 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{line_spacing} \alias{line_spacing} \title{Set text alignment} \usage{ line_spacing(x, i = NULL, j = NULL, space = 1, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{space}{space between lines of text, 1 is single line spacing, 2 is double line spacing.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change text alignment of selected rows and columns of a flextable. } \examples{ ft <- flextable(head(mtcars)[, 3:6]) ft <- line_spacing(ft, space = 1.6, part = "all") ft <- set_table_properties(ft, layout = "autofit") ft } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/paginate.Rd0000644000176200001440000000574414476430471015076 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/paginate.R \name{paginate} \alias{paginate} \title{Paginate tables} \usage{ paginate( x, init = NULL, hdr_ftr = TRUE, group = character(), group_def = c("rle", "nonempty") ) } \arguments{ \item{x}{flextable object} \item{init}{init value for keep_with_next property, it default value is \code{get_flextable_defaults()$keep_with_next}.} \item{hdr_ftr}{if TRUE (default), prevent breaks between table body and header and between table body and footer.} \item{group}{name of a column to use for finding groups} \item{group_def}{algorithm to be used to identify groups that should not be split into two pages, one of 'rle', 'nonempty': \itemize{ \item 'rle': runs of equal values are used to define the groups, to be used with \code{\link[=tabulator]{tabulator()}}. \item 'nonempty': non empty value start a new group, to be used with \code{\link[=as_flextable.tabular]{as_flextable.tabular()}}. }} } \value{ updated flextable object } \description{ Prevents breaks between tables rows you want to stay together. This feature only applies to Word and RTF output. } \details{ The pagination of tables allows you to control their position in relation to page breaks. For small tables, a simple setting is usually used that indicates that all rows should be displayed together: \if{html}{\out{
}}\preformatted{paginate(x, init = TRUE, hdr_ftr = TRUE) }\if{html}{\out{
}} For large tables, it is recommended to use a setting that indicates that all rows of the header should be bound to the first row of the table to avoid the case where the header is displayed alone at the bottom of the page and then repeated on the next one: \if{html}{\out{
}}\preformatted{paginate(x, init = FALSE, hdr_ftr = TRUE) }\if{html}{\out{
}} For tables that present groups that you don't want to be presented on two pages, you must use a parameterization involving the notion of group and an algorithm for determining the groups. \if{html}{\out{
}}\preformatted{paginate(x, group = "grp", group_def = "rle") }\if{html}{\out{
}} } \examples{ \dontshow{ data.table::setDTthreads(1) } library(data.table) library(flextable) init_flextable_defaults() multi_fun <- function(x) { list(mean = mean(x), sd = sd(x)) } dat <- as.data.table(ggplot2::diamonds) dat <- dat[clarity \%in\% c("I1", "SI1", "VS2")] dat <- dat[, unlist(lapply(.SD, multi_fun), recursive = FALSE ), .SDcols = c("z", "y"), by = c("cut", "color", "clarity") ] tab <- tabulator( x = dat, rows = c("cut", "color"), columns = "clarity", `z stats` = as_paragraph(as_chunk(fmt_avg_dev(z.mean, z.sd, digit2 = 2))), `y stats` = as_paragraph(as_chunk(fmt_avg_dev(y.mean, y.sd, digit2 = 2))) ) ft_1 <- as_flextable(tab) ft_1 <- autofit(x = ft_1, add_w = .05) |> paginate(group = "cut", group_def = "rle") save_as_docx(ft_1, path = tempfile(fileext = ".docx")) save_as_rtf(ft_1, path = tempfile(fileext = ".rtf")) } flextable/man/add_footer_row.Rd0000644000176200001440000000543114565457153016301 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_footer_row} \alias{add_footer_row} \title{Add footer labels} \usage{ add_footer_row(x, top = TRUE, values = character(0), colwidths = integer(0)) } \arguments{ \item{x}{a flextable object} \item{top}{should the row be inserted at the top or the bottom.} \item{values}{values to add. It can be a \code{list}, a \code{character()} vector or a call to \code{\link[=as_paragraph]{as_paragraph()}}. If it is a list, it can be a named list with the names of the columns of the original data.frame or the \code{colkeys}; this is the recommended method because it allows to keep the original data types and therefore allows to perform conditional formatting. If a character, columns of the original data.frame stored in the flextable object are changed to \code{character()}; this is often not an issue with footer and header but can be inconvenient if adding rows into body as it will change data types to character and prevent efficient conditional formatting.} \item{colwidths}{the number of columns to merge in the row for each label} } \description{ Add a row of new columns labels in footer part. Labels can be spanned along multiple columns, as merged cells. Labels are associated with a number of columns to merge that default to one if not specified. In this case, you have to make sure that the number of labels is equal to the number of columns displayed. The function can add only one single row by call. Labels can be formatted with \code{\link[=as_paragraph]{as_paragraph()}}. } \examples{ library(flextable) ft01 <- fp_text_default(color = "red") ft02 <- fp_text_default(color = "orange") pars <- as_paragraph( as_chunk(c("(1)", "(2)"), props = ft02), " ", as_chunk( c( "My tailor is rich", "My baker is rich" ), props = ft01 ) ) ft_1 <- flextable(head(mtcars)) ft_1 <- add_footer_row(ft_1, values = pars, colwidths = c(5, 6), top = FALSE ) ft_1 <- add_footer_row(ft_1, values = pars, colwidths = c(3, 8), top = TRUE ) ft_1 ft_2 <- flextable(head(airquality)) ft_2 <- add_footer_row(ft_2, values = c("Measure", "Time"), colwidths = c(4, 2), top = TRUE ) ft_2 <- theme_box(ft_2) ft_2 } \seealso{ \code{\link[=flextable]{flextable()}}, \code{\link[=set_caption]{set_caption()}} Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/border_inner_h.Rd0000644000176200001440000000221314565457153016256 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border_inner_h} \alias{border_inner_h} \title{Set inner borders} \usage{ border_inner_h(x, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying a border to inner content of one or all parts of a flextable. } \examples{ library(officer) std_border <- fp_border(color = "orange", width = 1) dat <- iris[c(1:5, 51:55, 101:105), ] ft <- flextable(dat) ft <- border_remove(x = ft) # add inner horizontal borders ft <- border_inner_h(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/delete_columns.Rd0000644000176200001440000000222714565457154016307 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{delete_columns} \alias{delete_columns} \title{Delete flextable columns} \usage{ delete_columns(x, j = NULL) } \arguments{ \item{x}{a \code{flextable} object} \item{j}{columns selection} } \description{ The function removes one or more columns from a 'flextable'. } \details{ Deleting one or more columns will result in the deletion of any span parameters that may have been set previously. They will have to be redone after this operation or performed only after this deletion. } \examples{ ft <- flextable(head(iris)) ft <- delete_columns(ft, j = "Species") ft } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/information_data_paragraph.Rd0000644000176200001440000000243414552463753020646 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/read_structure.R \name{information_data_paragraph} \alias{information_data_paragraph} \title{paragraph related information of a flextable} \usage{ information_data_paragraph(x) } \arguments{ \item{x}{a flextable object} } \value{ a data.frame containing information about paragraphs: \itemize{ \item formatting properties, \item part (\code{.part}), row (\code{.row_id}) and column (\code{.col_id}). } } \description{ This function takes a flextable object and returns a data.frame containing information about each paragraph within the flextable. The data.frame includes details about formatting properties and position within the row and column. } \section{don't use this}{ These data structures should not be used, as they represent an interpretation of the underlying data structures, which may evolve over time. \strong{They are exported to enable two packages that exploit these structures to make a transition, and should not remain available for long.} } \examples{ ft <- as_flextable(iris) x <- information_data_paragraph(ft) head(x) } \seealso{ Other information data functions: \code{\link{information_data_cell}()}, \code{\link{information_data_chunk}()} } \concept{information data functions} \keyword{internal} flextable/man/as_flextable.pam.Rd0000644000176200001440000000242114565457153016505 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.pam} \alias{as_flextable.pam} \title{Transform a 'pam' object into a flextable} \usage{ \method{as_flextable}{pam}(x, digits = 4, ...) } \arguments{ \item{x}{a \code{\link[cluster:pam]{cluster::pam()}} object} \item{digits}{number of digits for the numeric columns} \item{...}{unused argument} } \description{ produce a flextable describing a pam object. The function is only using package 'broom' that provides the data presented in the resulting flextable. } \examples{ if (require("cluster")) { dat <- as.data.frame(scale(mtcars[1:7])) cl <- pam(dat, 3) ft <- as_flextable(cl) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/fmt_2stats.Rd0000644000176200001440000000405114570173724015362 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_2stats} \alias{fmt_2stats} \alias{fmt_summarizor} \title{Format content for data generated with summarizor()} \usage{ fmt_2stats(stat, num1, num2, cts, pcts, ...) fmt_summarizor(stat, num1, num2, cts, pcts, ...) } \arguments{ \item{stat}{a character column containing the name of statictics} \item{num1}{a numeric statistic to display such as a mean or a median} \item{num2}{a numeric statistic to display such as a standard deviation or a median absolute deviation.} \item{cts}{a count to display} \item{pcts}{a percentage to display} \item{...}{unused arguments} } \description{ This function was written to allow easy demonstrations of flextable's ability to produce table summaries (with \code{\link[=summarizor]{summarizor()}}). It assumes that we have either a quantitative variable, in which case we will display the mean and the standard deviation, or a qualitative variable, in which case we will display the count and the percentage corresponding to each modality. } \examples{ library(flextable) z <- summarizor(iris, by = "Species") tab_1 <- tabulator( x = z, rows = c("variable", "stat"), columns = "Species", blah = as_paragraph( as_chunk( fmt_summarizor( stat = stat, num1 = value1, num2 = value2, cts = cts, pcts = percent ) ) ) ) ft_1 <- as_flextable(x = tab_1, separate_with = "variable") ft_1 <- labelizor( x = ft_1, j = "stat", labels = c( mean_sd = "Moyenne (ecart-type)", median_iqr = "Mediane (IQR)", range = "Etendue", missing = "Valeurs manquantes" ) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=summarizor]{summarizor()}}, \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/border_outer.Rd0000644000176200001440000000220214565457153015770 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border_outer} \alias{border_outer} \title{Set outer borders} \usage{ border_outer(x, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying a border to outer cells of one or all parts of a flextable. } \examples{ library(officer) big_border <- fp_border(color = "red", width = 2) dat <- iris[c(1:5, 51:55, 101:105), ] ft <- flextable(dat) ft <- border_remove(x = ft) # add outer borders ft <- border_outer(ft, part = "all", border = big_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/df_printer.Rd0000644000176200001440000000433714515040434015425 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/df_printer.R \name{df_printer} \alias{df_printer} \title{data.frame automatic printing as a flextable} \usage{ df_printer(dat, ...) } \arguments{ \item{dat}{the data.frame} \item{...}{unused argument} } \description{ Create a summary from a data.frame as a flextable. This function is to be used in an R Markdown document. To use that function, you must declare it in the part \code{df_print} of the 'YAML' header of your R Markdown document: \if{html}{\out{
}}\preformatted{--- df_print: !expr function(x) flextable::df_printer(x) --- }\if{html}{\out{
}} We notice an unexpected behavior with bookdown. When using bookdown it is necessary to use \code{\link[=use_df_printer]{use_df_printer()}} instead in a setup run chunk: \if{html}{\out{
}}\preformatted{use_df_printer() }\if{html}{\out{
}} } \details{ 'knitr' chunk options are available to customize the output: \itemize{ \item \code{ft_max_row}: The number of rows to print. Default to 10. \item \code{ft_split_colnames}: Should the column names be split (with non alpha-numeric characters). Default to FALSE. \item \code{ft_short_strings}: Should the character column be shorten. Default to FALSE. \item \code{ft_short_size}: Maximum length of character column if \code{ft_short_strings} is TRUE. Default to 35. \item \code{ft_short_suffix}: Suffix to add when character values are shorten. Default to "...". \item \code{ft_do_autofit}: Use autofit() before rendering the table. Default to TRUE. \item \code{ft_show_coltype}: Show column types. Default to TRUE. \item \code{ft_color_coltype}: Color to use for column types. Default to "#999999". } } \examples{ df_printer(head(mtcars)) } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/tabulator.Rd0000644000176200001440000001045014441705246015266 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable_tabulator.R \name{tabulator} \alias{tabulator} \alias{summary.tabulator} \title{Tabulation of aggregations} \usage{ tabulator( x, rows, columns, datasup_first = NULL, datasup_last = NULL, hidden_data = NULL, row_compose = list(), ... ) \method{summary}{tabulator}(object, ...) } \arguments{ \item{x}{an aggregated data.frame} \item{rows}{column names to use in rows dimensions} \item{columns}{column names to use in columns dimensions} \item{datasup_first}{additional data that will be merged with table and placed after the columns presenting the row dimensions.} \item{datasup_last}{additional data that will be merged with table and placed at the end of the table.} \item{hidden_data}{additional data that will be merged with table, the columns are not presented but can be used with \code{\link[=compose]{compose()}} or \code{\link[=mk_par]{mk_par()}} function.} \item{row_compose}{a list of call to \code{\link[=as_paragraph]{as_paragraph()}} - these calls will be applied to the row dimensions (the name is used to target the displayed column).} \item{...}{named arguments calling function \code{\link[=as_paragraph]{as_paragraph()}}. The names are used as labels and the values are evaluated when the flextable is created.} \item{object}{an object returned by function \code{tabulator()}.} } \value{ an object of class \code{tabulator}. } \description{ It tabulates a data.frame representing an aggregation which is then transformed as a flextable with \link[=as_flextable.tabulator]{as_flextable}. The function allows to define any display with the syntax of flextable in a table whose layout is showing dimensions of the aggregation across rows and columns. \if{html}{\out{ tabulator illustration }} } \section{Methods (by generic)}{ \itemize{ \item \code{summary(tabulator)}: call \code{summary()} to get a data.frame describing mappings between variables and their names in the flextable. This data.frame contains a column named \code{col_keys} where are stored the names that can be used for further selections. }} \note{ This is very first version of the function; be aware it can evolve or change. } \examples{ \dontrun{ set_flextable_defaults(digits = 2, border.color = "gray") library(data.table) # example 1 ---- if (require("stats")) { dat <- aggregate(breaks ~ wool + tension, data = warpbreaks, mean ) cft_1 <- tabulator( x = dat, rows = "wool", columns = "tension", `mean` = as_paragraph(as_chunk(breaks)), `(N)` = as_paragraph(as_chunk(length(breaks), formatter = fmt_int)) ) ft_1 <- as_flextable(cft_1) ft_1 } # example 2 ---- if (require("ggplot2")) { multi_fun <- function(x) { list(mean = mean(x), sd = sd(x)) } dat <- as.data.table(ggplot2::diamonds) dat <- dat[cut \%in\% c("Fair", "Good", "Very Good")] dat <- dat[, unlist(lapply(.SD, multi_fun), recursive = FALSE ), .SDcols = c("z", "y"), by = c("cut", "color") ] tab_2 <- tabulator( x = dat, rows = "color", columns = "cut", `z stats` = as_paragraph(as_chunk(fmt_avg_dev(z.mean, z.sd, digit2 = 2))), `y stats` = as_paragraph(as_chunk(fmt_avg_dev(y.mean, y.sd, digit2 = 2))) ) ft_2 <- as_flextable(tab_2) ft_2 <- autofit(x = ft_2, add_w = .05) ft_2 } # example 3 ---- # data.table version dat <- melt(as.data.table(iris), id.vars = "Species", variable.name = "name", value.name = "value" ) dat <- dat[, list( avg = mean(value, na.rm = TRUE), sd = sd(value, na.rm = TRUE) ), by = c("Species", "name") ] # dplyr version # library(dplyr) # dat <- iris \%>\% # pivot_longer(cols = -c(Species)) \%>\% # group_by(Species, name) \%>\% # summarise(avg = mean(value, na.rm = TRUE), # sd = sd(value, na.rm = TRUE), # .groups = "drop") tab_3 <- tabulator( x = dat, rows = c("Species"), columns = "name", `mean (sd)` = as_paragraph( as_chunk(avg), " (", as_chunk(sd), ")" ) ) ft_3 <- as_flextable(tab_3) ft_3 init_flextable_defaults() } } \seealso{ \code{\link[=as_flextable.tabulator]{as_flextable.tabulator()}}, \code{\link[=summarizor]{summarizor()}}, \code{\link[=as_grouped_data]{as_grouped_data()}}, \code{\link[=tabulator_colnames]{tabulator_colnames()}} } flextable/man/color.Rd0000644000176200001440000000424514566144245014420 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{color} \alias{color} \title{Set font color} \usage{ color(x, i = NULL, j = NULL, color, part = "body", source = j) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{color}{color to use as font color. If a function, function need to return a character vector of colors.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} \item{source}{if color is a function, source is specifying the dataset column to be used as argument to \code{color}. This is only useful if j is colored with values contained in other columns.} } \description{ Change text color of selected rows and columns of a flextable. A function can be used instead of fixed colors. When \code{color} is a function, it is possible to color cells based on values located in other columns, using hidden columns (those not used by argument \code{colkeys}) is a common use case. The argument \code{source} has to be used to define what are the columns to be used for the color definition and the argument \code{j} has to be used to define where to apply the colors and only accept values from \code{colkeys}. } \examples{ ft <- flextable(head(mtcars)) ft <- color(ft, color = "orange", part = "header") ft <- color(ft, color = "red", i = ~ qsec < 18 & vs < 1 ) ft if (require("scales")) { scale <- scales::col_numeric(domain = c(-1, 1), palette = "RdBu") x <- as.data.frame(cor(iris[-5])) x <- cbind( data.frame( colname = colnames(x), stringsAsFactors = FALSE ), x ) ft_2 <- flextable(x) ft_2 <- color(ft_2, j = x$colname, color = scale) ft_2 <- set_formatter_type(ft_2) ft_2 } } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/as_flextable.htest.Rd0000644000176200001440000000231514565457153017061 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.htest} \alias{as_flextable.htest} \title{Transform a 'htest' object into a flextable} \usage{ \method{as_flextable}{htest}(x, ...) } \arguments{ \item{x}{htest object} \item{...}{unused argument} } \description{ produce a flextable describing an object oof class \code{htest}. } \examples{ if (require("stats")) { M <- as.table(rbind(c(762, 327, 468), c(484, 239, 477))) dimnames(M) <- list( gender = c("F", "M"), party = c("Democrat", "Independent", "Republican") ) ft_1 <- as_flextable(chisq.test(M)) ft_1 } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/flextable_html_dependency.Rd0000644000176200001440000000073714476430471020473 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/html_str.R \name{flextable_html_dependency} \alias{flextable_html_dependency} \title{htmlDependency for flextable objects} \usage{ flextable_html_dependency() } \description{ When using loops in an R Markdown for HTML document, the htmlDependency object for flextable must also be added at least once. } \examples{ if (require("htmltools")) { div(flextable_html_dependency()) } } \keyword{internal} flextable/man/set_flextable_defaults.Rd0000644000176200001440000001530114571560656020011 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{set_flextable_defaults} \alias{set_flextable_defaults} \alias{init_flextable_defaults} \title{Modify flextable defaults formatting properties} \usage{ set_flextable_defaults( font.family = NULL, font.size = NULL, font.color = NULL, text.align = NULL, padding = NULL, padding.bottom = NULL, padding.top = NULL, padding.left = NULL, padding.right = NULL, border.color = NULL, border.width = NULL, background.color = NULL, line_spacing = NULL, table.layout = NULL, cs.family = NULL, eastasia.family = NULL, hansi.family = NULL, decimal.mark = NULL, big.mark = NULL, digits = NULL, pct_digits = NULL, na_str = NULL, nan_str = NULL, fmt_date = NULL, fmt_datetime = NULL, extra_css = NULL, scroll = NULL, table_align = "center", split = NULL, keep_with_next = NULL, tabcolsep = NULL, arraystretch = NULL, float = NULL, fonts_ignore = NULL, theme_fun = NULL, post_process_all = NULL, post_process_pdf = NULL, post_process_docx = NULL, post_process_html = NULL, post_process_pptx = NULL, ... ) init_flextable_defaults() } \arguments{ \item{font.family}{single character value. When format is Word, it specifies the font to be used to format characters in the Unicode range (U+0000-U+007F). If you want to use non ascii characters in Word, you should also set \code{hansi.family} to the same family name.} \item{font.size}{font size (in point) - 0 or positive integer value.} \item{font.color}{font color - a single character value specifying a valid color (e.g. "#000000" or "black").} \item{text.align}{text alignment - a single character value, expected value is one of 'left', 'right', 'center', 'justify'.} \item{padding}{padding (shortcut for top, bottom, left and right padding)} \item{padding.bottom, padding.top, padding.left, padding.right}{paragraph paddings - 0 or positive integer value.} \item{border.color}{border color - single character value (e.g. "#000000" or "black").} \item{border.width}{border width in points.} \item{background.color}{cell background color - a single character value specifying a valid color (e.g. "#000000" or "black").} \item{line_spacing}{space between lines of text, 1 is single line spacing, 2 is double line spacing.} \item{table.layout}{'autofit' or 'fixed' algorithm. Default to 'autofit'.} \item{cs.family}{optional and only for Word. Font to be used to format characters in a complex script Unicode range. For example, Arabic text might be displayed using the "Arial Unicode MS" font.} \item{eastasia.family}{optional and only for Word. Font to be used to format characters in an East Asian Unicode range. For example, Japanese text might be displayed using the "MS Mincho" font.} \item{hansi.family}{optional and only for Word. Font to be used to format characters in a Unicode range which does not fall into one of the other categories.} \item{decimal.mark, big.mark, na_str, nan_str}{\link{formatC} arguments used by \code{\link[=colformat_num]{colformat_num()}}, \code{\link[=colformat_double]{colformat_double()}}, and \code{\link[=colformat_int]{colformat_int()}}.} \item{digits}{\link{formatC} argument used by \code{\link[=colformat_double]{colformat_double()}}.} \item{pct_digits}{number of digits for percentages.} \item{fmt_date, fmt_datetime}{formats for date and datetime columns as documented in \code{\link[=strptime]{strptime()}}. Default to '\%Y-\%m-\%d' and '\%Y-\%m-\%d \%H:\%M:\%S'.} \item{extra_css}{css instructions to be integrated with the table.} \item{scroll}{NULL or a list if you want to add a scroll-box. See \strong{scroll} element of argument \code{opts_html} in function \code{\link[=set_table_properties]{set_table_properties()}}.} \item{table_align}{default flextable alignment, supported values are 'left', 'center' and 'right'.} \item{split}{Word option 'Allow row to break across pages' can be activated when TRUE.} \item{keep_with_next}{default initialization value used by the \code{\link[=paginate]{paginate()}} function corresponding to the Word option "keep rows together" that will be defined in the array.} \item{tabcolsep}{space between the text and the left/right border of its containing cell.} \item{arraystretch}{height of each row relative to its default height, the default value is 1.5.} \item{float}{type of floating placement in the PDF document, one of: \itemize{ \item 'none' (the default value), table is placed after the preceding paragraph. \item 'float', table can float to a place in the text where it fits best \item 'wrap-r', wrap text around the table positioned to the right side of the text \item 'wrap-l', wrap text around the table positioned to the left side of the text \item 'wrap-i', wrap text around the table positioned inside edge-near the binding \item 'wrap-o', wrap text around the table positioned outside edge-far from the binding }} \item{fonts_ignore}{if TRUE, pdf-engine pdflatex can be used instead of xelatex or lualatex. If pdflatex is used, fonts will be ignored because they are not supported by pdflatex, whereas with the xelatex and lualatex engines they are.} \item{theme_fun}{a single character value (the name of the theme function to be applied) or a theme function (input is a flextable, output is a flextable).} \item{post_process_all}{Post-processing function that will allow you to customize the the table. It will be executed before call to post_process_pdf(), post_process_docx(), post_process_html(), post_process_pptx().} \item{post_process_pdf, post_process_docx, post_process_html, post_process_pptx}{Post-processing functions that will allow you to customize the display by output type (pdf, html, docx, pptx). They are executed just before printing the table.} \item{...}{unused or deprecated arguments} } \value{ a list containing previous default values. } \description{ The current formatting properties (see \code{\link[=get_flextable_defaults]{get_flextable_defaults()}}) are automatically applied to every flextable you produce. Use \code{set_flextable_defaults()} to override them. Use \code{init_flextable_defaults()} to re-init all values with the package defaults. } \examples{ ft_1 <- qflextable(head(airquality)) ft_1 old <- set_flextable_defaults( font.color = "#AA8855", border.color = "#8855AA" ) ft_2 <- qflextable(head(airquality)) ft_2 do.call(set_flextable_defaults, old) } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/as_paragraph.Rd0000644000176200001440000000340014375473105015720 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_paragraph} \alias{as_paragraph} \title{Concatenate chunks in a flextable} \usage{ as_paragraph(..., list_values = NULL) } \arguments{ \item{...}{chunk elements that are defining paragraph. If a character is used, it is transformed to a chunk object with function \code{\link[=as_chunk]{as_chunk()}}.} \item{list_values}{a list of chunk elements that are defining paragraph. If specified argument \code{...} is unused.} } \description{ The function is concatenating text and images within paragraphs of a flextable object, this function is to be used with functions such as \code{\link[=compose]{compose()}}, \code{\link[=add_header_lines]{add_header_lines()}}, \code{\link[=add_footer_lines]{add_footer_lines()}}. This allows the concatenation of formatted pieces of text (chunks) that represent the content of a paragraph. The cells of a flextable contain each a single paragraph. This paragraph is made of chunks that can be text, images or plots, equations and links. } \examples{ library(flextable) ft <- flextable(airquality[sample.int(150, size = 10), ]) ft <- compose(ft, j = "Wind", value = as_paragraph( as_chunk(Wind, props = fp_text_default(color = "orange")), " ", minibar(value = Wind, max = max(airquality$Wind), barcol = "orange", bg = "black", height = .15) ), part = "body" ) ft <- autofit(ft) ft } \seealso{ \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=minibar]{minibar()}}, \code{\link[=as_image]{as_image()}}, \code{\link[=hyperlink_text]{hyperlink_text()}} Other functions for mixed content paragraphs: \code{\link{append_chunks}()}, \code{\link{compose}()}, \code{\link{prepend_chunks}()} } \concept{functions for mixed content paragraphs} flextable/man/colformat_image.Rd0000644000176200001440000000247314565457154016440 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_image} \alias{colformat_image} \title{Format cells as images} \usage{ colformat_image( x, i = NULL, j = NULL, width, height, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{width, height}{size of the png file in inches} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format image paths as images in a flextable. } \examples{ img.file <- file.path(R.home("doc"), "html", "logo.jpg") dat <- head(iris) dat$Species <- as.character(dat$Species) dat[c(1, 3, 5), "Species"] <- img.file myft <- flextable(dat) myft <- colformat_image( myft, i = c(1, 3, 5), j = "Species", width = .20, height = .15 ) ft <- autofit(myft) ft } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/keep_with_next.Rd0000644000176200001440000000300614566144245016311 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{keep_with_next} \alias{keep_with_next} \title{Set Word 'Keep with next' instructions} \usage{ keep_with_next(x, i = NULL, value = TRUE, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{value}{TRUE or FALSE. When applied to a group, all rows except the last one should be flagged with attribute 'Keep with next'.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The 'Keep with next' functionality in 'Word', applied to the rows of a table, ensures that the rows with that attribute stays together and does not break across multiple pages. This function allows much better control of breaks between pages than the global \code{keep_with_next} parameter. } \examples{ library(flextable) dat <- iris[c(1:25, 51:75, 101:125), ] ft <- qflextable(dat) ft <- keep_with_next( x = ft, i = c(1:24, 26:49, 51:74), value = TRUE ) save_as_docx(ft, path = tempfile(fileext = ".docx")) } \seealso{ \code{\link[=paginate]{paginate()}} Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/figures/0000755000176200001440000000000014571444477014460 5ustar liggesusersflextable/man/figures/README-diamonds-dataset-1.png0000644000176200001440000014411214571444444021475 0ustar liggesusersPNG  IHDRsoâgAMA asRGB3PLTEGpLbtRNSi8O ",ģ IDATx]隭 2xiChɟnJ:Yd}/K^|+ V 33 y4=6v l=;;x6iOgUoa6= XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXVg ~nF7?s ,`S8QGuܥ|[pH.B*M5{4y9 p& iXKX5*|Y熞OD7 Ηp7q(4i[EΙ df_D> lNq,4i;e >qOw74*c4i`fڵB˵S``|bQsQ>~A|V*uJ9lN oVѱ'k*es^~v@ @ib8 v(F6= 𭦝|)  JɐB8mp9ei YyهдxZ/?9 ,@i@zM>KDz޵9a`9bj5:ܪ;Ǒмu*RXy]c{qqۏap헟PGi40,SZhuڷirCʣ>Owû|łup o~'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Zu=Lh^jT|CMn~֮yv&pt~~r/b q_PNX3U'ns:+V+$78bj~S%6N^TM5x3|@r0Ƒ\?dknj>q2q:_2q])j4c&ptqӾ3k`8@Hf}\afd#Y/LynNUcL\.\ǺBpd`c+wr6TLD&hOWJu,J1Uz)CrP+ ;ιh"hIZ=eSsU/KSM ;un&\o'#Zj B!9](M\.L< EJ|`gkoapH'{AjʏGZ 2U&pt:.T} I|:ʉv0+ -G/f䧞rO)?SS_ĕrDHl9lc*'kNUȹO^!7zIoηEOR0y"EԁcT7r.xe޼b/1rX!pGULeMp^f"Vyp 8nX')' &n3)xx&t9[30 N 12sZʉu0)('{o s+ZJicT5y4S+_9gW=ǚ2kK8Ch@ @ @ @0I"}}g/ L]IENDB`flextable/man/empty_blanks.Rd0000644000176200001440000000336714566144245015776 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{empty_blanks} \alias{empty_blanks} \title{Make blank columns as transparent} \usage{ empty_blanks(x, width = 0.05, unit = "in", part = "all") } \arguments{ \item{x}{a flextable object} \item{width}{width of blank columns (.1 inch by default).} \item{unit}{unit for width, one of "in", "cm", "mm".} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ blank columns are set as transparent. This is a shortcut function that will delete top and bottom borders, change background color to transparent, display empty content and set blank columns' width. } \examples{ typology <- data.frame( col_keys = c( "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species" ), what = c("Sepal", "Sepal", "Petal", "Petal", " "), measure = c("Length", "Width", "Length", "Width", "Species"), stringsAsFactors = FALSE ) typology ftab <- flextable(head(iris), col_keys = c( "Species", "break1", "Sepal.Length", "Sepal.Width", "break2", "Petal.Length", "Petal.Width" )) ftab <- set_header_df(ftab, mapping = typology, key = "col_keys") ftab <- merge_h(ftab, part = "header") ftab <- theme_vanilla(ftab) ftab <- empty_blanks(ftab) ftab <- width(ftab, j = c(2, 5), width = .1) ftab } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/merge_none.Rd0000644000176200001440000000201214565457154015413 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/merge_flextable.R \name{merge_none} \alias{merge_none} \title{Delete flextable merging informations} \usage{ merge_none(x, part = "all") } \arguments{ \item{x}{\code{flextable} object} \item{part}{partname of the table where merge has to be done.} } \description{ Delete all merging informations from a flextable. } \examples{ typology <- data.frame( col_keys = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species"), what = c("Sepal", "Sepal", "Petal", "Petal", "Species"), measure = c("Length", "Width", "Length", "Width", "Species"), stringsAsFactors = FALSE ) ft <- flextable(head(iris)) ft <- set_header_df(ft, mapping = typology, key = "col_keys") ft <- merge_v(ft, j = c("Species")) ft <- theme_tron_legacy(merge_none(ft)) ft } \seealso{ Other flextable merging function: \code{\link{merge_at}()}, \code{\link{merge_h}()}, \code{\link{merge_h_range}()}, \code{\link{merge_v}()} } \concept{flextable merging function} flextable/man/plot.flextableGrob.Rd0000644000176200001440000000055614310450150017016 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/grid_grobs.R \name{plot.flextableGrob} \alias{plot.flextableGrob} \title{plot a flextable grob} \usage{ \method{plot}{flextableGrob}(x, ...) } \arguments{ \item{x}{a flextableGrob object} \item{...}{additional arguments passed to other functions} } \description{ plot a flextable grob } flextable/man/as_flextable.Rd0000644000176200001440000000216114410655214015715 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable} \alias{as_flextable} \title{Method to transform objects into flextables} \usage{ as_flextable(x, ...) } \arguments{ \item{x}{object to be transformed as flextable} \item{...}{arguments for custom methods} } \description{ This is a convenient function to let users create flextable bindings from any objects. Users should consult documentation of corresponding method to understand the details and see what arguments can be used. } \seealso{ Other as_flextable methods: \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/append_chunks.Rd0000644000176200001440000000250714375473105016121 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/append_chunk.R \name{append_chunks} \alias{append_chunks} \title{Append chunks to flextable content} \usage{ append_chunks(x, ..., i = NULL, j = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{...}{chunks to be appened, see \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=gg_chunk]{gg_chunk()}} and other chunk elements for paragraph.} \item{i}{rows selection} \item{j}{column selection} \item{part}{partname of the table (one of 'body', 'header', 'footer')} } \description{ append chunks (for example chunk \code{\link[=as_chunk]{as_chunk()}}) in a flextable. } \examples{ library(flextable) img.file <- file.path(R.home("doc"), "html", "logo.jpg") ft_1 <- flextable(head(cars)) ft_1 <- append_chunks(ft_1, # where to append i = c(1, 3, 5), j = 1, # what to append as_chunk(" "), as_image(src = img.file, width = .20, height = .15) ) ft_1 <- set_table_properties(ft_1, layout = "autofit") ft_1 } \seealso{ \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=as_sup]{as_sup()}}, \code{\link[=as_sub]{as_sub()}}, \code{\link[=colorize]{colorize()}} Other functions for mixed content paragraphs: \code{\link{as_paragraph}()}, \code{\link{compose}()}, \code{\link{prepend_chunks}()} } \concept{functions for mixed content paragraphs} flextable/man/as_flextable.kmeans.Rd0000644000176200001440000000237014565457153017211 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.kmeans} \alias{as_flextable.kmeans} \title{Transform a 'kmeans' object into a flextable} \usage{ \method{as_flextable}{kmeans}(x, digits = 4, ...) } \arguments{ \item{x}{a \code{\link[=kmeans]{kmeans()}} object} \item{digits}{number of digits for the numeric columns} \item{...}{unused argument} } \description{ produce a flextable describing a kmeans object. The function is only using package 'broom' that provides the data presented in the resulting flextable. } \examples{ if (require("stats")) { cl <- kmeans(scale(mtcars[1:7]), 5) ft <- as_flextable(cl) ft } } \seealso{ Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.grouped_data}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/as_equation.Rd0000644000176200001440000000403214567175517015613 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_equation} \alias{as_equation} \title{Equation chunk} \usage{ as_equation(x, width = 1, height = 0.2, unit = "in", props = NULL) } \arguments{ \item{x}{values containing the 'MathJax' equations} \item{width, height}{size of the resulting equation} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{props}{an \code{\link[=fp_text_default]{fp_text_default()}} or \code{\link[officer:fp_text]{officer::fp_text()}} object to be used to format the text. If not specified, it will be the default value corresponding to the cell.} } \description{ This function is used to insert equations into flextable. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. To use this function, package 'equatags' is required; also \code{equatags::mathjax_install()} must be executed only once to install necessary dependencies. } \examples{ library(flextable) if (require("equatags")) { eqs <- c( "(ax^2 + bx + c = 0)", "a \\\\ne 0", "x = {-b \\\\pm \\\\sqrt{b^2-4ac} \\\\over 2a}" ) df <- data.frame(formula = eqs) df ft <- flextable(df) ft <- compose( x = ft, j = "formula", value = as_paragraph(as_equation(formula, width = 2, height = .5)) ) ft <- align(ft, align = "center", part = "all") ft <- width(ft, width = 2) ft } } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/tab_settings.Rd0000644000176200001440000000311514566144366015767 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{tab_settings} \alias{tab_settings} \title{Set tabulation marks configuration} \usage{ tab_settings(x, i = NULL, j = NULL, value = TRUE, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{value}{an object of generated by \code{\link[officer:fp_tabs]{officer::fp_tabs()}}.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ Define tabulation marks configuration. Specifying positions and types of tabulation marks in table paragraphs helps to organize the content, especially in clinical tables by aligning numbers properly. } \examples{ library(officer) library(flextable) z <- data.frame( Statistic = c("Median (Q1 ; Q3)", "Min ; Max"), Value = c( "\t999.99\t(99.9 ; 99.9)", "\t9.99\t(9999.9 ; 99.9)" ) ) ts <- fp_tabs( fp_tab(pos = 0.4, style = "decimal"), fp_tab(pos = 1.4, style = "decimal") ) zz <- flextable(z) |> tab_settings(j = 2, value = ts) |> width(width = c(1.5, 2)) save_as_docx(zz, path = tempfile(fileext = ".docx")) } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/dim_pretty.Rd0000644000176200001440000000255214255321756015460 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable_sizes.R \name{dim_pretty} \alias{dim_pretty} \title{Calculate pretty dimensions} \usage{ dim_pretty(x, part = "all", unit = "in", hspans = "none") } \arguments{ \item{x}{flextable object} \item{part}{partname of the table (one of 'all', 'body', 'header' or 'footer')} \item{unit}{unit for returned values, one of "in", "cm", "mm".} \item{hspans}{specifies how cells that are horizontally are included in the calculation. It must be one of the following values "none", "divided" or "included". If "none", widths of horizontally spanned cells is set to 0 (then do not affect the widths); if "divided", widths of horizontally spanned cells is divided by the number of spanned cells; if "included", all widths (included horizontally spanned cells) will be used in the calculation.} } \description{ return minimum estimated widths and heights for each table columns and rows in inches. } \examples{ ftab <- flextable(head(mtcars)) dim_pretty(ftab) } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{set_table_properties}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/theme_vanilla.Rd0000644000176200001440000000433214565457154016114 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_vanilla} \alias{theme_vanilla} \title{Apply vanilla theme} \usage{ theme_vanilla(x) } \arguments{ \item{x}{a flextable object} } \description{ Apply theme vanilla to a flextable: The external horizontal lines of the different parts of the table (body, header, footer) are black 2 points thick, the external horizontal lines of the different parts are black 0.5 point thick. Header text is bold, text columns are left aligned, other columns are right aligned. } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_vanilla(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/vline.Rd0000644000176200001440000000230614565457154014420 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{vline} \alias{vline} \title{Set vertical borders} \usage{ vline(x, i = NULL, j = NULL, border = NULL, part = "all") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{border}{border properties defined by a call to \code{\link[=fp_border]{fp_border()}}} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function is applying vertical borders to inner content of one or all parts of a flextable. The lines are the right borders of selected cells. } \examples{ library(officer) std_border <- fp_border(color = "orange") ft <- flextable(head(iris)) ft <- border_remove(x = ft) # add vertical borders ft <- vline(ft, border = std_border) ft } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/body_add_flextable.Rd0000644000176200001440000000746114571701317017073 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/body_add_flextable.R \name{body_add_flextable} \alias{body_add_flextable} \title{Add flextable into a Word document} \usage{ body_add_flextable( x, value, align = NULL, pos = "after", split = NULL, topcaption = TRUE, keepnext = NULL ) } \arguments{ \item{x}{an rdocx object} \item{value}{\code{flextable} object} \item{align}{left, center (default) or right. The \code{align} parameter is still supported for the time being, but we recommend using \code{set_flextable_defaults(table_align = "center")} instead that will set this default alignment for all flextables during the R session, or to define alignement for each table with \code{set_table_properties(align = "center")}.} \item{pos}{where to add the flextable relative to the cursor, one of "after", "before", "on" (end of line).} \item{split}{set to TRUE if you want to activate Word option 'Allow row to break across pages'. This argument is still supported for the time being, but we recommend using \code{set_flextable_defaults(split = TRUE)} instead that will set this as default setting for all flextables during the R session, or to define alignement for each table with \code{\link[=set_table_properties]{set_table_properties()}} with argument \code{opts_word=list(split = TRUE)} instead.} \item{topcaption}{if TRUE caption is added before the table, if FALSE, caption is added after the table.} \item{keepnext}{Defunct in favor of \code{\link[=paginate]{paginate()}}. The default value used for \code{keep_with_next} is set with \code{set_flextable_defaults(keep_with_next = TRUE)}.} } \description{ Add a flextable into a Word document created with 'officer'. } \details{ Use the \code{\link[=paginate]{paginate()}} function to define whether the table should be displayed on one or more pages, and whether the header should be displayed with the first lines of the table body on the same page. Use the \code{\link[=set_caption]{set_caption()}} function to define formatted captions (with \code{\link[=as_paragraph]{as_paragraph()}}) or simple captions (with a string). \code{topcaption} can be used to insert the caption before the table (default) or after the table (use \code{FALSE}). } \examples{ \dontshow{ init_flextable_defaults() } library(officer) # define global settings set_flextable_defaults( split = TRUE, table_align = "center", table.layout = "autofit" ) # produce 3 flextable ft_1 <- flextable(head(airquality, n = 20)) ft_1 <- color(ft_1, i = ~ Temp > 70, color = "red", j = "Temp") ft_1 <- highlight(ft_1, i = ~ Wind < 8, color = "yellow", j = "Wind") ft_1 <- set_caption( x = ft_1, autonum = run_autonum(seq_id = "tab"), caption = "Daily air quality measurements" ) ft_1 <- paginate(ft_1, init = TRUE, hdr_ftr = TRUE) ft_2 <- proc_freq(mtcars, "vs", "gear") ft_2 <- set_caption( x = ft_2, autonum = run_autonum(seq_id = "tab", bkm = "mtcars"), caption = as_paragraph( as_b("mtcars"), " ", colorize("table", color = "orange") ), fp_p = fp_par(keep_with_next = TRUE) ) ft_2 <- paginate(ft_2, init = TRUE, hdr_ftr = TRUE) ft_3 <- summarizor(iris, by = "Species") ft_3 <- as_flextable(ft_3, spread_first_col = TRUE) ft_3 <- set_caption( x = ft_3, autonum = run_autonum(seq_id = "tab"), caption = "iris summary" ) ft_3 <- paginate(ft_3, init = TRUE, hdr_ftr = TRUE) # add the 3 flextable in a new Word document doc <- read_docx() doc <- body_add_flextable(doc, value = ft_1) doc <- body_add_par(doc, value = "") doc <- body_add_flextable(doc, value = ft_2) doc <- body_add_par(doc, value = "") doc <- body_add_flextable(doc, value = ft_3) fileout <- tempfile(fileext = ".docx") print(doc, target = fileout) \dontshow{ init_flextable_defaults() } } \seealso{ \code{\link[=knit_print.flextable]{knit_print.flextable()}}, \code{\link[=save_as_docx]{save_as_docx()}} } flextable/man/delete_rows.Rd0000644000176200001440000000235114565457154015617 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{delete_rows} \alias{delete_rows} \title{Delete flextable rows} \usage{ delete_rows(x, i = NULL, part = "body") } \arguments{ \item{x}{a \code{flextable} object} \item{i}{rows selection} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function removes one or more rows from a 'flextable'. } \details{ Deleting one or more rows will result in the deletion of any span parameters that may have been set previously. They will have to be redone after this operation or performed only after this deletion. } \examples{ ft <- flextable(head(iris)) ft <- delete_rows(ft, i = 1:5, part = "body") ft } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/border_remove.Rd0000644000176200001440000000151114565457153016131 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border_remove} \alias{border_remove} \title{Remove borders} \usage{ border_remove(x) } \arguments{ \item{x}{a flextable object} } \description{ The function is deleting all borders of the flextable object. } \examples{ dat <- iris[c(1:5, 51:55, 101:105), ] ft_1 <- flextable(dat) ft_1 <- theme_box(ft_1) ft_1 # remove all borders ft_2 <- border_remove(x = ft_1) ft_2 } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{surround}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/align.Rd0000644000176200001440000000445514615441001014360 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{align} \alias{align} \alias{align_text_col} \alias{align_nottext_col} \title{Set text alignment} \usage{ align( x, i = NULL, j = NULL, align = "left", part = c("body", "header", "footer", "all") ) align_text_col(x, align = "left", header = TRUE, footer = TRUE) align_nottext_col(x, align = "right", header = TRUE, footer = TRUE) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{align}{text alignment - a single character value, or a vector of character values equal in length to the number of columns selected by \code{j}. Expected values must be from the set of ('left', 'right', 'center', or 'justify'). If the number of columns is a multiple of the length of the \code{align} parameter, then the values in \code{align} will be recycled across the remaining columns.} \item{part}{partname of the table (one of 'body', 'header', 'footer', 'all')} \item{header}{should the header be aligned with the body} \item{footer}{should the footer be aligned with the body} } \description{ change text alignment of selected rows and columns of a flextable. } \examples{ # Table of 6 columns ft_car <- flextable(head(mtcars)[, 2:7]) # All 6 columns right aligned align(ft_car, align = "right", part = "all") # Manually specify alignment of each column align( ft_car, align = c("left", "right", "left", "center", "center", "right"), part = "all") # Center-align column 2 and left-align column 5 align(ft_car, j = c(2, 5), align = c("center", "left"), part = "all") # Alternate left and center alignment across columns 1-4 for header only align(ft_car, j = 1:4, align = c("left", "center"), part = "header") ftab <- flextable(mtcars) ftab <- align_text_col(ftab, align = "left") ftab <- align_nottext_col(ftab, align = "right") ftab } \seealso{ Other sugar functions for table style: \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/colformat_double.Rd0000644000176200001440000000244714565457154016631 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_double} \alias{colformat_double} \title{Format numeric cells} \usage{ colformat_double( x, i = NULL, j = NULL, big.mark = get_flextable_defaults()$big.mark, decimal.mark = get_flextable_defaults()$decimal.mark, digits = get_flextable_defaults()$digits, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{big.mark, digits, decimal.mark}{see \code{\link[=formatC]{formatC()}}} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format numeric cells in a flextable. } \examples{ dat <- mtcars ft <- flextable(head(dat)) ft <- colformat_double( x = ft, big.mark = ",", digits = 2, na_str = "N/A" ) autofit(ft) } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/footnote.Rd0000644000176200001440000000457514507616476015152 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/footnote.R \name{footnote} \alias{footnote} \title{Add footnotes to flextable} \usage{ footnote( x, i = NULL, j = NULL, value, ref_symbols = NULL, part = "body", inline = FALSE, sep = "; " ) } \arguments{ \item{x}{a flextable object} \item{i, j}{cellwise rows and columns selection} \item{value}{a call to function \code{\link[=as_paragraph]{as_paragraph()}}.} \item{ref_symbols}{character value, symbols to append that will be used as references to notes.} \item{part}{partname of the table (one of 'body', 'header', 'footer')} \item{inline}{whether to add footnote on same line as previous footnote or not} \item{sep}{used only when inline = TRUE, character string to use as a separator between footnotes.} } \description{ The function let add footnotes to a flextable object by adding some symbols in the flextable and associated notes in the footer of the flextable. Symbols are added to the cells designated by the selection \code{i} and \code{j}. If you use i = c(1,3) and j = c(2,5), then you will add the symbols (or the repeated symbol) to cells \verb{[1,2]} and \verb{[3,5]}. \if{html}{\out{ add_footer illustration See https://www.ardata.fr/en/flextable-gallery/2022-06-23-separate-headers/ for the example shown }} } \examples{ ft_1 <- flextable(head(iris)) ft_1 <- footnote(ft_1, i = 1, j = 1:3, value = as_paragraph( c( "This is footnote one", "This is footnote two", "This is footnote three" ) ), ref_symbols = c("a", "b", "c"), part = "header" ) ft_1 <- valign(ft_1, valign = "bottom", part = "header") ft_1 <- autofit(ft_1) ft_2 <- flextable(head(iris)) ft_2 <- autofit(ft_2) ft_2 <- footnote(ft_2, i = 1, j = 1:2, value = as_paragraph( c( "This is footnote one", "This is footnote two" ) ), ref_symbols = c("a", "b"), part = "header", inline = TRUE ) ft_2 <- footnote(ft_2, i = 1, j = 3:4, value = as_paragraph( c( "This is footnote three", "This is footnote four" ) ), ref_symbols = c("c", "d"), part = "header", inline = TRUE ) ft_2 ft_3 <- flextable(head(iris)) ft_3 <- autofit(ft_3) ft_3 <- footnote( x = ft_3, i = 1:3, j = 1:3, ref_symbols = "a", value = as_paragraph("This is footnote one") ) ft_3 } flextable/man/rotate.Rd0000644000176200001440000000640714566144245014602 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{rotate} \alias{rotate} \title{Rotate cell text} \usage{ rotate(x, i = NULL, j = NULL, rotation, align = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{rotation}{one of "lrtb", "tbrl", "btlr".} \item{align}{vertical alignment of paragraph within cell, one of "center" or "top" or "bottom".} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ It can be useful to be able to change the direction, when the table headers are huge for example, header labels can be rendered as "tbrl" (top to bottom and right to left) corresponding to a 90 degrees rotation or "btlr" corresponding to a 270 degrees rotation. The function change cell text direction. By default, it is "lrtb" which mean from left to right and top to bottom. 'Word' and 'PowerPoint' don't handle auto height with rotated headers. So you need to set header heights (with function \code{\link[=height]{height()}}) and set rule "exact" for rows heights (with function \code{\link[=hrule]{hrule()}}) otherwise Word and PowerPoint outputs will have small height not corresponding to the necessary height to display the text. flextable doesn't do the rotation by any angle. It only rotates by a number of right angles. This choice is made to ensure the same rendering between Word, PowerPoint (limited to angles 0, 270 and 90) HTML and PDF. } \details{ When function \code{autofit} is used, the rotation will be ignored. In that case, use \link{dim_pretty} and \link{width} instead of \link{autofit}. } \examples{ library(flextable) ft_1 <- flextable(head(iris)) ft_1 <- rotate(ft_1, j = 1:4, align = "bottom", rotation = "tbrl", part = "header") ft_1 <- rotate(ft_1, j = 5, align = "bottom", rotation = "btlr", part = "header") # if output is docx or pptx, think about (1) set header heights # and (2) set rule "exact" for rows heights because Word # and PowerPoint don't handle auto height with rotated headers ft_1 <- height(ft_1, height = 1.2, part = "header") ft_1 <- hrule(ft_1, i = 1, rule = "exact", part = "header") ft_1 dat <- data.frame( a = c("left-top", "left-middle", "left-bottom"), b = c("center-top", "center-middle", "center-bottom"), c = c("right-top", "right-middle", "right-bottom") ) ft_2 <- flextable(dat) ft_2 <- theme_box(ft_2) ft_2 <- height_all(x = ft_2, height = 1.3, part = "body") ft_2 <- hrule(ft_2, rule = "exact") ft_2 <- rotate(ft_2, rotation = "tbrl") ft_2 <- width(ft_2, width = 1.3) ft_2 <- align(ft_2, j = 1, align = "left") ft_2 <- align(ft_2, j = 2, align = "center") ft_2 <- align(ft_2, j = 3, align = "right") ft_2 <- valign(ft_2, i = 1, valign = "top") ft_2 <- valign(ft_2, i = 2, valign = "center") ft_2 <- valign(ft_2, i = 3, valign = "bottom") ft_2 } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/add_body.Rd0000644000176200001440000000422414565457153015050 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_body} \alias{add_body} \title{Add column values as new lines in body} \usage{ add_body(x, top = TRUE, ..., values = NULL) } \arguments{ \item{x}{a flextable object} \item{top}{should the rows be inserted at the top or the bottom.} \item{...}{named arguments (names are data colnames) of values to add. It is important to insert data of the same type as the original data, otherwise it will be transformed (probably into strings if you add a \code{character} where a \code{double} is expected). This makes possible to still format cell contents with the \verb{colformat_*} functions, for example \code{\link[=colformat_num]{colformat_num()}}.} \item{values}{a list of name-value pairs of labels or values, names should be existing col_key values. This argument can be used instead of \code{...} for programming purpose (If \code{values} is supplied argument \code{...} is ignored).} } \description{ The function adds a list of values to be inserted as new rows in the body. The values are inserted in existing columns of the input data of the flextable. Rows can be inserted at the top or the bottom of the body. If some columns are not provided, they will be replaced by \code{NA} and displayed as empty. } \examples{ ft <- flextable(head(iris), col_keys = c( "Species", "Sepal.Length", "Petal.Length", "Sepal.Width", "Petal.Width" ) ) ft <- add_body( x = ft, Sepal.Length = 1:5, Sepal.Width = 1:5 * 2, Petal.Length = 1:5 * 3, Petal.Width = 1:5 + 10, Species = "Blah", top = FALSE ) ft <- theme_booktabs(ft) ft } \seealso{ \code{\link[=flextable]{flextable()}} Other functions for row and column operations in a flextable: \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/lollipop.Rd0000644000176200001440000000532014615215365015124 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{lollipop} \alias{lollipop} \title{Mini lollipop chart chunk wrapper} \usage{ lollipop( value, min = NULL, max = NULL, rangecol = "#CCCCCC", bg = "transparent", width = 1, height = 0.2, unit = "in", raster_width = 30, positivecol = "#00CC00", negativecol = "#CC0000", neutralcol = "#CCCCCC", neutralrange = c(0, 0), rectanglesize = 2 ) } \arguments{ \item{value}{values containing the bar size} \item{min}{min bar size. Default min of value} \item{max}{max bar size. Default max of value} \item{rangecol}{bar color} \item{bg}{background color} \item{width, height}{size of the resulting png file in inches} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{raster_width}{number of pixels used as width} \item{positivecol}{box color of positive values} \item{negativecol}{box color of negative values} \item{neutralcol}{box color of neutral values} \item{neutralrange}{minimal and maximal range of neutral values (default: 0)} \item{rectanglesize}{size of the rectangle (default: 2, max: 5) when interpolating value.} } \description{ This function is used to insert lollipop charts into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } It is now deprecated and will be soon defunct because we think it produces ugly results. Use \code{\link[=gg_chunk]{gg_chunk()}} to replace it. } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ iris$Sepal.Ratio <- (iris$Sepal.Length - mean(iris$Sepal.Length)) / mean(iris$Sepal.Length) ft <- flextable(tail(iris, n = 10)) ft <- compose(ft, j = "Sepal.Ratio", value = as_paragraph( lollipop(value = Sepal.Ratio, min = -.25, max = .25) ), part = "body" ) ft <- autofit(ft) ft } \seealso{ \code{\link[=compose]{compose()}}, \code{\link[=as_paragraph]{as_paragraph()}} Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/set_formatter.Rd0000644000176200001440000000515614565457154016167 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{set_formatter} \alias{set_formatter} \alias{set_formatter_type} \title{Set column formatter functions} \usage{ set_formatter(x, ..., values = NULL, part = "body") set_formatter_type( x, fmt_double = "\%.03f", fmt_integer = "\%.0f", fmt_date = "\%Y-\%m-\%d", fmt_datetime = "\%Y-\%m-\%d \%H:\%M:\%S", true = "true", false = "false", na_str = "" ) } \arguments{ \item{x}{a flextable object} \item{...}{Name-value pairs of functions, names should be existing col_key values} \item{values}{format functions, If values is supplied argument \code{...} is ignored. \itemize{ \item It can be a list of name-value pairs of functions, names should be existing col_key values. \item If \code{values} is a single function, it will be applied to each column. }} \item{part}{part of the table (one of 'body' or 'header' or 'footer') where to apply the formatter functions.} \item{fmt_double, fmt_integer}{arguments used by \code{sprintf} to format double and integer columns.} \item{fmt_date, fmt_datetime}{arguments used by \code{format} to format date and date time columns.} \item{false, true}{string to be used for logical columns} \item{na_str}{string for NA values} } \description{ Apply formatter functions to column keys. Functions should have a single argument (the vector) and should return the formatted values as a character vector. } \section{set_formatter_type}{ \code{set_formatter_type} is an helper function to quickly define formatter functions regarding to column types. This function will be deprecated in favor of the \verb{colformat_*} functions, for example \code{\link[=colformat_double]{colformat_double()}}. Note that we want to deprecate the \code{set_formatter_type()} function, not the \code{set_formatter()} function. } \examples{ ft <- flextable(head(iris)) ft <- set_formatter( x = ft, Sepal.Length = function(x) sprintf("\%.02f", x), Sepal.Width = function(x) sprintf("\%.04f", x) ) ft <- theme_vanilla(ft) ft } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()} Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_datetime}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()} } \concept{cells formatters} flextable/man/save_as_image.Rd0000644000176200001440000000346614600640713016057 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{save_as_image} \alias{save_as_image} \title{Save a flextable in a 'png' or 'svg' file} \usage{ save_as_image(x, path, expand = 10, res = 200, ...) } \arguments{ \item{x}{a flextable object} \item{path}{image file to be created. It should end with '.png' or '.svg'.} \item{expand}{space in pixels to add around the table.} \item{res}{The resolution of the device} \item{...}{unused arguments} } \value{ a string containing the full name of the generated file } \description{ Save a flextable as a png or svg image. This function uses R graphic system to create an image from the flextable, allowing for high-quality image output. See \code{\link[=gen_grob]{gen_grob()}} for more options. } \section{caption}{ It's important to note that captions are not part of the table itself. This means when exporting a table to PNG or SVG formats (image formats), the caption won't be included. Captions are intended for document outputs like Word, HTML, or PDF, where tables are embedded within the document itself. } \examples{ library(gdtools) register_liberationsans() set_flextable_defaults(font.family = "Liberation Sans") ft <- flextable(head(mtcars)) ft <- autofit(ft) tf <- tempfile(fileext = ".png") save_as_image(x = ft, path = tf) init_flextable_defaults() } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/rtf_add.flextable.Rd0000644000176200001440000000124014371453413016634 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/rtf_str.R \name{rtf_add.flextable} \alias{rtf_add.flextable} \title{Add a 'flextable' into an RTF document} \usage{ \method{rtf_add}{flextable}(x, value, ...) } \arguments{ \item{x}{rtf object, created by \code{\link[=rtf_doc]{rtf_doc()}}.} \item{value}{a flextable object} \item{...}{unused arguments} } \description{ \code{\link[=rtf_add]{rtf_add()}} method for adding flextable objects into 'RTF' documents. } \examples{ library(flextable) library(officer) ft <- flextable(head(iris)) ft <- autofit(ft) z <- rtf_doc() z <- rtf_add(z, ft) print(z, target = tempfile(fileext = ".rtf")) } flextable/man/colformat_datetime.Rd0000644000176200001440000000233014402205763017125 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formatters.R \name{colformat_datetime} \alias{colformat_datetime} \title{Format datetime cells} \usage{ colformat_datetime( x, i = NULL, j = NULL, fmt_datetime = get_flextable_defaults()$fmt_datetime, na_str = get_flextable_defaults()$na_str, nan_str = get_flextable_defaults()$nan_str, prefix = "", suffix = "" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection.} \item{fmt_datetime}{see \code{\link[=strptime]{strptime()}}} \item{na_str, nan_str}{string to be used for NA and NaN values} \item{prefix, suffix}{string to be used as prefix or suffix} } \description{ Format datetime cells in a flextable. } \examples{ dat <- data.frame( z = Sys.time() + (1:3) * 24, w = Sys.Date() - (1:3) * 24 ) ft <- flextable(dat) ft <- colformat_datetime(x = ft) ft <- autofit(ft) ft } \seealso{ Other cells formatters: \code{\link{colformat_char}()}, \code{\link{colformat_date}()}, \code{\link{colformat_double}()}, \code{\link{colformat_image}()}, \code{\link{colformat_int}()}, \code{\link{colformat_lgl}()}, \code{\link{colformat_num}()}, \code{\link{set_formatter}()} } \concept{cells formatters} flextable/man/add_footer_lines.Rd0000644000176200001440000000251314565457153016602 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_footer_lines} \alias{add_footer_lines} \title{Add labels as new rows in the footer} \usage{ add_footer_lines(x, values = character(0), top = FALSE) } \arguments{ \item{x}{a \code{flextable} object} \item{values}{a character vector or a call to \code{\link[=as_paragraph]{as_paragraph()}} to get formated content, each element will be added as a new row.} \item{top}{should the row be inserted at the top or the bottom. Default to TRUE.} } \description{ Add labels as new rows in the footer, where all columns are merged. This is a sugar function to be used when you need to add labels in the footer, a footnote for example. } \examples{ ft_1 <- flextable(head(iris)) ft_1 <- add_footer_lines(ft_1, values = c("blah 1", "blah 2") ) ft_1 } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/merge_h_range.Rd0000644000176200001440000000172514476430471016063 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/merge_flextable.R \name{merge_h_range} \alias{merge_h_range} \title{Rowwise merge of a range of columns} \usage{ merge_h_range(x, i = NULL, j1 = NULL, j2 = NULL, part = "body") } \arguments{ \item{x}{\code{flextable} object} \item{i}{selected rows} \item{j1, j2}{selected columns that will define the range of columns to merge.} \item{part}{partname of the table where merge has to be done.} } \description{ Merge flextable columns into a single one for each selected rows. All columns must be consecutive. } \examples{ ft <- flextable(head(mtcars), cwidth = .5) ft <- theme_box(ft) ft <- merge_h_range(ft, i = ~ cyl == 6, j1 = "am", j2 = "carb") ft <- flextable::align(ft, i = ~ cyl == 6, align = "center") ft } \seealso{ Other flextable merging function: \code{\link{merge_at}()}, \code{\link{merge_h}()}, \code{\link{merge_none}()}, \code{\link{merge_v}()} } \concept{flextable merging function} flextable/man/as_bracket.Rd0000644000176200001440000000303214565457153015375 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_bracket} \alias{as_bracket} \title{Chunk with values in brackets} \usage{ as_bracket(..., sep = ", ", p = "(", s = ")") } \arguments{ \item{...}{text and column names} \item{sep}{separator} \item{p}{prefix, default to '('} \item{s}{suffix, default to ')'} } \description{ The function is producing a chunk by pasting values and add the result in brackets. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("Species", "Sepal", "Petal") ) ft <- set_header_labels(ft, Sepal = "Sepal", Petal = "Petal") ft <- compose(ft, j = "Sepal", value = as_paragraph(as_bracket(Sepal.Length, Sepal.Width)) ) ft <- compose(ft, j = "Petal", value = as_paragraph(as_bracket(Petal.Length, Petal.Width)) ) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/fmt_avg_dev.Rd0000644000176200001440000000203214570173725015553 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_avg_dev} \alias{fmt_avg_dev} \title{Format content for mean and sd} \usage{ fmt_avg_dev(avg, dev, digit1 = 1, digit2 = 1) } \arguments{ \item{avg, dev}{mean and sd values} \item{digit1, digit2}{number of digits to show when printing 'mean' and 'sd'.} } \description{ The function formats means and standard deviations as \code{mean (sd)}. } \examples{ library(flextable) df <- data.frame(avg = 1:3 * 3, sd = 1:3) ft_1 <- flextable(df, col_keys = "avg") ft_1 <- mk_par( x = ft_1, j = 1, part = "body", value = as_paragraph(fmt_avg_dev(avg = avg, dev = sd)) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/flextable.Rd0000644000176200001440000000700714255321756015246 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable.R \name{flextable} \alias{flextable} \alias{qflextable} \title{flextable creation} \usage{ flextable( data, col_keys = names(data), cwidth = 0.75, cheight = 0.25, defaults = list(), theme_fun = theme_booktabs ) qflextable(data) } \arguments{ \item{data}{dataset} \item{col_keys}{columns names/keys to display. If some column names are not in the dataset, they will be added as blank columns by default.} \item{cwidth, cheight}{initial width and height to use for cell sizes in inches.} \item{defaults, theme_fun}{deprecated, use \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} instead.} } \description{ Create a flextable object with function \code{flextable}. \code{flextable} are designed to make tabular reporting easier for R users. Functions are available to let you format text, paragraphs and cells; table cells can be merge vertically or horizontally, row headers can easily be defined, rows heights and columns widths can be manually set or automatically computed. If working with 'R Markdown' documents, you should read about knitr chunk options in \code{\link[=knit_print.flextable]{knit_print.flextable()}} and about setting default values with \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}. } \section{Reuse frequently used parameters}{ Some default formatting properties are automatically applied to every flextable you produce. It is highly recommended to use this function because its use will minimize the code. For example, instead of calling the \code{fontsize()} function over and over again for each new flextable, set the font size default value by calling (before creating the flextables) \code{set_flextable_defaults(font.size = 11)}. This is also a simple way to have homogeneous arrays and make the documents containing them easier to read. You can change these default values with function \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}. You can reset them with function \code{\link[=init_flextable_defaults]{init_flextable_defaults()}}. You can access these values by calling \code{\link[=get_flextable_defaults]{get_flextable_defaults()}}. } \section{new lines and tabulations}{ The 'flextable' package will translate for you the new lines expressed in the form \verb{\\n} and the tabs expressed in the form \verb{\\t}. The new lines will be transformed into "soft-return", that is to say a simple carriage return and not a new paragraph. Tabs are different depending on the output format: \itemize{ \item HTML is using entity \emph{em space} \item Word - a Word 'tab' element \item PowerPoint - a PowerPoint 'tab' element \item latex - tag "\\quad " } } \section{flextable parts}{ A \code{flextable} is made of 3 parts: header, body and footer. Most functions have an argument named \code{part} that will be used to specify what part of of the table should be modified. } \section{qflextable}{ \code{qflextable} is a convenient tool to produce quickly a flextable for reporting where layout is fixed (see \code{\link[=set_table_properties]{set_table_properties()}}) and columns widths are adjusted with \code{\link[=autofit]{autofit()}}. } \examples{ ft <- flextable(head(mtcars)) ft } \seealso{ \code{\link[=style]{style()}}, \code{\link[=autofit]{autofit()}}, \code{\link[=theme_booktabs]{theme_booktabs()}}, \code{\link[=knit_print.flextable]{knit_print.flextable()}}, \code{\link[=compose]{compose()}}, \code{\link[=footnote]{footnote()}}, \code{\link[=set_caption]{set_caption()}} } flextable/man/add_footer.Rd0000644000176200001440000000432014565457153015406 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_footer} \alias{add_footer} \title{Add column values as new lines in footer} \usage{ add_footer(x, top = TRUE, ..., values = NULL) } \arguments{ \item{x}{a flextable object} \item{top}{should the rows be inserted at the top or the bottom.} \item{...}{named arguments (names are data colnames) of values to add. It is important to insert data of the same type as the original data, otherwise it will be transformed (probably into strings if you add a \code{character} where a \code{double} is expected). This makes possible to still format cell contents with the \verb{colformat_*} functions, for example \code{\link[=colformat_num]{colformat_num()}}.} \item{values}{a list of name-value pairs of labels or values, names should be existing col_key values. This argument can be used instead of \code{...} for programming purpose (If \code{values} is supplied argument \code{...} is ignored).} } \description{ The function adds a list of values to be inserted as new rows in the footer. The values are inserted in existing columns of the input data of the flextable. Rows can be inserted at the top or the bottom of the footer. If some columns are not provided, they will be replaced by \code{NA} and displayed as empty. } \examples{ new_row <- as.list(colMeans(iris[, -5])) new_row$Species <- "Means" formatter <- function(x) sprintf("\%.1f", x) ft <- flextable(data = head(iris)) ft <- add_footer(ft, values = new_row) # cosmetics ft <- compose( x = ft, j = 1:4, value = as_paragraph( as_chunk(., formatter = formatter) ), part = "footer", use_dot = TRUE ) ft <- align(ft, part = "footer", align = "right", j = 1:4) ft } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/htmltools_value.Rd0000644000176200001440000000252014515040434016502 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{htmltools_value} \alias{htmltools_value} \title{flextable as an 'HTML' object} \usage{ htmltools_value( x, ft.align = NULL, ft.shadow = NULL, extra_dependencies = NULL ) } \arguments{ \item{x}{a flextable object} \item{ft.align}{flextable alignment, supported values are 'left', 'center' and 'right'.} \item{ft.shadow}{deprecated.} \item{extra_dependencies}{a list of HTML dependencies to add in the HTML output.} } \value{ an object marked as \link{HTML} ready to be used within a call to \code{shiny::renderUI} for example. } \description{ get a \code{\link[=div]{div()}} from a flextable object. This can be used in a shiny application. For an output within "R Markdown" document, use \link{knit_print.flextable}. } \examples{ htmltools_value(flextable(iris[1:5, ])) } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/font.Rd0000644000176200001440000000513514566144245014247 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{font} \alias{font} \title{Set font} \usage{ font( x, i = NULL, j = NULL, fontname, part = "body", cs.family = fontname, hansi.family = fontname, eastasia.family = fontname ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{fontname}{single character value, the font family name. With Word and PowerPoint output, the value specifies the font to be used to format characters in the Unicode range (U+0000-U+007F).} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} \item{cs.family}{Optional font to be used to format characters in a complex script Unicode range. For example, Arabic text might be displayed using the "Arial Unicode MS" font. Used only with Word and PowerPoint outputs. Its default value is the value of \code{fontname}.} \item{hansi.family}{optional. Specifies the font to be used to format characters in a Unicode range which does not fall into one of the other categories. Used only with Word and PowerPoint outputs. Its default value is the value of \code{fontname}.} \item{eastasia.family}{optional font to be used to format characters in an East Asian Unicode range. For example, Japanese text might be displayed using the "MS Mincho" font. Used only with Word and PowerPoint outputs. Its default value is the value of \code{fontname}.} } \description{ Change font of selected rows and columns of a flextable. Fonts impact the readability and aesthetics of the table. Font families refer to a set of typefaces that share common design features, such as 'Arial' and 'Open Sans'. 'Google Fonts' is a popular library of free web fonts that can be easily integrated in flextable with function \code{\link[gdtools:register_gfont]{gdtools::register_gfont()}}. When output is HTML, the font will be automatically added in the HTML document. } \examples{ library(gdtools) fontname <- "Brush Script MT" if (font_family_exists(fontname)) { ft_1 <- flextable(head(iris)) ft_2 <- font(ft_1, fontname = fontname, part = "header") ft_2 <- font(ft_2, fontname = fontname, j = 5) ft_2 } } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/set_table_properties.Rd0000644000176200001440000001216314571560656017522 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable.R \name{set_table_properties} \alias{set_table_properties} \title{Global table properties} \usage{ set_table_properties( x, layout = "fixed", width = 0, align = NULL, opts_html = list(), opts_word = list(), opts_pdf = list(), word_title = NULL, word_description = NULL ) } \arguments{ \item{x}{flextable object} \item{layout}{'autofit' or 'fixed' algorithm. Default to 'autofit'.} \item{width}{The parameter has a different effect depending on the output format. Users should consider it as a minimum width. In HTML, it is the minimum width of the space that the table should occupy. In Word, it is a preferred size and Word may decide not to strictly stick to it. It has no effect on PowerPoint and PDF output. Its default value is 0, as an effect, it only use necessary width to display all content. It is not used by the PDF output.} \item{align}{alignment in document (only Word, HTML and PDF), supported values are 'left', 'center' and 'right'.} \item{opts_html}{html options as a list. Supported elements are: \itemize{ \item 'extra_css': extra css instructions to be integrated with the HTML code of the table. \item 'scroll': NULL or a list if you want to add a scroll-box. \itemize{ \item Use an empty list to add an horizontal scroll. The with is fixed, corresponding to the container's width. \item If the list has a value named \code{height} it will be used as height and the scroll will happen also vertically. The height will be in pixel if numeric, if a string it should be a valid css measure. \item If the list has a value named \code{freeze_first_column} set to \code{TRUE}, the first column is set as a \emph{sticky} column. \item If the list has a value named \code{add_css} it will be used as extra css to add, .i.e: \verb{border:1px solid red;}. } }} \item{opts_word}{Word options as a list. Supported elements are: \itemize{ \item 'split': Word option 'Allow row to break across pages' can be activated when TRUE. \item 'keep_with_next': Word option 'keep rows together' is activated when TRUE. It avoids page break within tables. This is handy for small tables, i.e. less than a page height. }} \item{opts_pdf}{PDF options as a list. Supported elements are: \itemize{ \item 'tabcolsep': space between the text and the left/right border of its containing cell. \item 'arraystretch': height of each row relative to its default height, the default value is 1.5. \item 'float': type of floating placement in the PDF document, one of: \itemize{ \item 'none' (the default value), table is placed after the preceding paragraph. \item 'float', table can float to a place in the text where it fits best \item 'wrap-r', wrap text around the table positioned to the right side of the text \item 'wrap-l', wrap text around the table positioned to the left side of the text \item 'wrap-i', wrap text around the table positioned inside edge-near the binding \item 'wrap-o', wrap text around the table positioned outside edge-far from the binding } \item 'fonts_ignore': if TRUE, pdf-engine 'pdflatex' can be used instead of 'xelatex' or 'lualatex.' If pdflatex is used, fonts will be ignored because they are not supported by pdflatex, whereas with the xelatex and lualatex engines they are. \item 'caption_repeat': a boolean that indicates if the caption should be repeated along pages. Its default value is \code{TRUE}. \item 'footer_repeat': a boolean that indicates if the footer should be repeated along pages. Its default value is \code{TRUE}. \item 'default_line_color': default line color, restored globally after the flextable is produced. }} \item{word_title}{alternative text for Word table (used as title of the table)} \item{word_description}{alternative text for Word table (used as description of the table)} } \description{ Set table layout and table width. Default to fixed algorithm. If layout is fixed, column widths will be used to display the table; \code{width} is ignored. If layout is autofit, column widths will not be used; table width is used (as a percentage). } \note{ PowerPoint output ignore 'autofit layout'. } \examples{ library(flextable) ft_1 <- flextable(head(cars)) ft_1 <- autofit(ft_1) ft_2 <- set_table_properties(ft_1, width = .5, layout = "autofit") ft_2 ft_3 <- set_table_properties(ft_1, width = 1, layout = "autofit") # add scroll for HTML ---- set.seed(2) dat <- lapply(1:14, function(x) rnorm(n = 20)) dat <- setNames(dat, paste0("colname", 1:14)) dat <- as.data.frame(dat) ft_4 <- flextable(dat) ft_4 <- colformat_double(ft_4) ft_4 <- bg(ft_4, j = 1, bg = "#DDDDDD", part = "all") ft_4 <- bg(ft_4, i = 1, bg = "#DDDDDD", part = "header") ft_4 <- autofit(ft_4) ft_4 <- set_table_properties( x = ft_4, opts_html = list( scroll = list( height = "500px", freeze_first_column = TRUE ) ) ) ft_4 } \seealso{ Other flextable dimensions: \code{\link{autofit}()}, \code{\link{dim.flextable}()}, \code{\link{dim_pretty}()}, \code{\link{fit_to_width}()}, \code{\link{flextable_dim}()}, \code{\link{height}()}, \code{\link{hrule}()}, \code{\link{ncol_keys}()}, \code{\link{nrow_part}()}, \code{\link{width}()} } \concept{flextable dimensions} flextable/man/save_as_html.Rd0000644000176200001440000000342514515040434015733 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{save_as_html} \alias{save_as_html} \title{Save flextable objects in an 'HTML' file} \usage{ save_as_html(..., values = NULL, path, lang = "en", title = " ") } \arguments{ \item{...}{flextable objects, objects, possibly named. If named objects, names are used as titles.} \item{values}{a list (possibly named), each element is a flextable object. If named objects, names are used as titles. If provided, argument \code{...} will be ignored.} \item{path}{HTML file to be created} \item{lang}{language of the document using IETF language tags} \item{title}{page title} } \value{ a string containing the full name of the generated file } \description{ save a flextable in an 'HTML' file. This function is useful to save the flextable in 'HTML' file without using R Markdown (it is highly recommanded to use R Markdown instead). } \examples{ ft1 <- flextable(head(iris)) tf1 <- tempfile(fileext = ".html") if (rmarkdown::pandoc_available()) { save_as_html(ft1, path = tf1) # browseURL(tf1) } ft2 <- flextable(head(mtcars)) tf2 <- tempfile(fileext = ".html") if (rmarkdown::pandoc_available()) { save_as_html( `iris table` = ft1, `mtcars table` = ft2, path = tf2, title = "rhoooo" ) # browseURL(tf2) } } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/add_header_lines.Rd0000644000176200001440000000313314364612403016517 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_header_lines} \alias{add_header_lines} \title{Add labels as new rows in the header} \usage{ add_header_lines(x, values = character(0), top = TRUE) } \arguments{ \item{x}{a \code{flextable} object} \item{values}{a character vector or a call to \code{\link[=as_paragraph]{as_paragraph()}} to get formated content, each element will be added as a new row.} \item{top}{should the row be inserted at the top or the bottom. Default to TRUE.} } \description{ Add labels as new rows in the header, where all columns are merged. This is a sugar function to be used when you need to add labels in the header, most of the time it will be used to adding titles on the top rows of the flextable. } \examples{ # ex 1---- ft_1 <- flextable(head(iris)) ft_1 <- add_header_lines(ft_1, values = "blah blah") ft_1 <- add_header_lines(ft_1, values = c("blah 1", "blah 2")) ft_1 <- autofit(ft_1) ft_1 # ex 2---- ft01 <- fp_text_default(color = "red") ft02 <- fp_text_default(color = "orange") ref <- c("(1)", "(2)") pars <- as_paragraph( as_chunk(ref, props = ft02), " ", as_chunk(rep("My tailor is rich", length(ref)), props = ft01) ) ft_2 <- flextable(head(mtcars)) ft_2 <- add_header_lines(ft_2, values = pars, top = FALSE) ft_2 <- add_header_lines(ft_2, values = ref, top = TRUE) ft_2 <- add_footer_lines(ft_2, values = "blah", top = TRUE) ft_2 <- add_footer_lines(ft_2, values = pars, top = TRUE) ft_2 <- add_footer_lines(ft_2, values = ref, top = FALSE) ft_2 <- autofit(ft_2) ft_2 } \concept{functions that add rows in the table} flextable/man/print.flextable.Rd0000644000176200001440000000356014515040434016367 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{print.flextable} \alias{print.flextable} \title{flextable printing} \usage{ \method{print}{flextable}(x, preview = "html", align = "center", ...) } \arguments{ \item{x}{flextable object} \item{preview}{preview type, one of c("html", "pptx", "docx", "rtf", "pdf, "log"). When \code{"log"} is used, a description of the flextable is printed.} \item{align}{left, center (default) or right. Only for docx/html/pdf.} \item{...}{arguments for 'pdf_document' call when preview is "pdf".} } \description{ print a flextable object to format \code{html}, \code{docx}, \code{pptx} or as text (not for display but for informative purpose). This function is to be used in an interactive context. } \note{ When argument \code{preview} is set to \code{"docx"} or \code{"pptx"}, an external client linked to these formats (Office is installed) is used to edit a document. The document is saved in the temporary directory of the R session and will be removed when R session will be ended. When argument \code{preview} is set to \code{"html"}, an external client linked to these HTML format is used to display the table. If RStudio is used, the Viewer is used to display the table. Note also that a print method is used when flextable are used within R markdown documents. See \code{\link[=knit_print.flextable]{knit_print.flextable()}}. } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/dim.flextableGrob.Rd0000644000176200001440000000110114310450150016574 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/grid_grobs.R \name{dim.flextableGrob} \alias{dim.flextableGrob} \title{Get optimal width and height of a flextable grob} \usage{ \method{dim}{flextableGrob}(x) } \arguments{ \item{x}{a flextableGrob object} } \value{ a named list with two elements, \code{width} and \code{height}. Values are expressed in inches. } \description{ returns the optimal width and height for the grob, according to the grob generation parameters. } \examples{ ftab <- flextable(head(iris)) gr <- gen_grob(ftab) dim(gr) } flextable/man/as_flextable.grouped_data.Rd0000644000176200001440000000365414565457153020377 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable.R \name{as_flextable.grouped_data} \alias{as_flextable.grouped_data} \title{Transform a 'grouped_data' object into a flextable} \usage{ \method{as_flextable}{grouped_data}(x, col_keys = NULL, hide_grouplabel = FALSE, ...) } \arguments{ \item{x}{'grouped_data' object to be transformed into a "flextable"} \item{col_keys}{columns names/keys to display. If some column names are not in the dataset, they will be added as blank columns by default.} \item{hide_grouplabel}{if TRUE, group label will not be rendered, only level/value will be rendered.} \item{...}{unused argument} } \description{ Produce a flextable from a table produced by function \code{\link[=as_grouped_data]{as_grouped_data()}}. } \examples{ library(data.table) CO2 <- CO2 setDT(CO2) CO2$conc <- as.integer(CO2$conc) data_co2 <- dcast(CO2, Treatment + conc ~ Type, value.var = "uptake", fun.aggregate = mean ) data_co2 <- as_grouped_data(x = data_co2, groups = c("Treatment")) ft <- as_flextable(data_co2) ft <- add_footer_lines(ft, "dataset CO2 has been used for this flextable") ft <- add_header_lines(ft, "mean of carbon dioxide uptake in grass plants") ft <- set_header_labels(ft, conc = "Concentration") ft <- autofit(ft) ft <- width(ft, width = c(1, 1, 1)) ft } \seealso{ \code{\link[=as_grouped_data]{as_grouped_data()}} Other as_flextable methods: \code{\link{as_flextable}()}, \code{\link{as_flextable.data.frame}()}, \code{\link{as_flextable.gam}()}, \code{\link{as_flextable.glm}()}, \code{\link{as_flextable.htest}()}, \code{\link{as_flextable.kmeans}()}, \code{\link{as_flextable.lm}()}, \code{\link{as_flextable.merMod}()}, \code{\link{as_flextable.pam}()}, \code{\link{as_flextable.summarizor}()}, \code{\link{as_flextable.table}()}, \code{\link{as_flextable.tabular}()}, \code{\link{as_flextable.tabulator}()}, \code{\link{as_flextable.xtable}()} } \concept{as_flextable methods} flextable/man/fmt_int.Rd0000644000176200001440000000154414570173724014740 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_int} \alias{fmt_int} \title{Format numerical data as integer} \usage{ fmt_int(x) } \arguments{ \item{x}{numeric values} } \description{ The function formats numeric vectors as integer. } \examples{ library(flextable) df <- data.frame(zz = 1.23) ft_1 <- flextable(df) ft_1 <- mk_par( x = ft_1, j = 1, part = "body", value = as_paragraph(as_chunk(zz, formatter = fmt_int)) ) ft_1 <- autofit(ft_1) ft_1 } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()}, \code{\link{fmt_signif_after_zeros}()} } \concept{text formatter functions} flextable/man/theme_zebra.Rd0000644000176200001440000000421114565457154015565 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_zebra} \alias{theme_zebra} \title{Apply zebra theme} \usage{ theme_zebra( x, odd_header = "#CFCFCF", odd_body = "#EFEFEF", even_header = "transparent", even_body = "transparent" ) } \arguments{ \item{x}{a flextable object} \item{odd_header, odd_body, even_header, even_body}{odd/even colors for table header and body} } \description{ Apply theme zebra to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_zebra(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()} } \concept{functions related to themes} flextable/man/as_sup.Rd0000644000176200001440000000272014565457153014574 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_sup} \alias{as_sup} \title{Superscript chunk} \usage{ as_sup(x) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} } \description{ The function is producing a chunk with superscript vertical alignment. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \note{ This is a sugar function that ease the composition of complex labels made of different formattings. It should be used inside a call to \code{\link[=as_paragraph]{as_paragraph()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("dummy")) ft <- compose(ft, i = 1, j = "dummy", part = "header", value = as_paragraph( " anything ", as_sup("Sepal.Width") ) ) ft <- autofit(ft) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/gg_chunk.Rd0000644000176200001440000000465114565457154015075 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/chunk_images.R \name{gg_chunk} \alias{gg_chunk} \title{'ggplots' chunk wrapper} \usage{ gg_chunk(value, width = 1, height = 0.2, unit = "in", res = 300) } \arguments{ \item{value}{gg objects, stored in a list column; or a list of 'ggplot' objects.} \item{width, height}{size of the resulting png file.} \item{unit}{unit for width and height, one of "in", "cm", "mm".} \item{res}{resolution of the png image in ppi} } \description{ This function is used to insert mini gg plots into flextable with functions: \itemize{ \item \code{\link[=compose]{compose()}} and \code{\link[=as_paragraph]{as_paragraph()}}, \item \code{\link[=append_chunks]{append_chunks()}}, \item \code{\link[=prepend_chunks]{prepend_chunks()}}. } } \note{ This chunk option requires package officedown in a R Markdown context with Word output format. PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format. } \examples{ library(data.table) library(flextable) if (require("ggplot2")) { my_cor_plot <- function(x) { cols <- colnames(x)[sapply(x, is.numeric)] x <- x[, .SD, .SDcols = cols] cormat <- as.data.table(cor(x)) cormat$var1 <- colnames(cormat) cormat <- melt(cormat, id.vars = "var1", measure.vars = cormat$var1, variable.name = "var2", value.name = "correlation" ) ggplot(data = cormat, aes(x = var1, y = var2, fill = correlation)) + geom_tile() + coord_equal() + scale_fill_gradient2( low = "blue", mid = "white", high = "red", limits = c(-1, 1), guide = "none" ) + theme_void() } z <- as.data.table(iris) z <- z[, list(gg = list(my_cor_plot(.SD))), by = "Species"] ft <- flextable(z) ft <- mk_par(ft, j = "gg", value = as_paragraph( gg_chunk(value = gg, width = 1, height = 1) ) ) ft } } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/as_i.Rd0000644000176200001440000000230314565457153014212 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_i} \alias{as_i} \title{Italic chunk} \usage{ as_i(x) } \arguments{ \item{x}{value, if a chunk, the chunk will be updated} } \description{ The function is producing a chunk with italic font. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. } \examples{ ft <- flextable(head(iris), col_keys = c("Sepal.Length", "dummy") ) ft <- compose(ft, j = "dummy", value = as_paragraph(as_i(Sepal.Length)) ) ft } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{as_word_field}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/flextable-package.Rd0000644000176200001440000000440314615444445016635 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable-package.R \docType{package} \name{flextable-package} \alias{flextable-package} \title{flextable: Functions for Tabular Reporting} \description{ The flextable package facilitates access to and manipulation of tabular reporting elements from R. The documentation of functions can be opened with command \code{help(package = "flextable")}. \code{flextable()} function is producing flexible tables where each cell can contain several chunks of text with their own set of formatting properties (bold, font color, etc.). Function \code{\link[=mk_par]{mk_par()}} lets customise text of cells. The \code{\link[=as_flextable]{as_flextable()}} function is used to transform specific objects into flextable objects. For example, you can transform a crosstab produced with the 'tables' package into a flextable which can then be formatted, annotated or augmented with footnotes. In order to reduce the homogenization efforts and the number of functions to be called, it is recommended to define formatting properties such as font, border color, number of decimals displayed which will then be applied by default. See \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} for more details. } \seealso{ \url{https://davidgohel.github.io/flextable/}, \url{https://ardata-fr.github.io/flextable-book/}, \code{\link[=flextable]{flextable()}} } \author{ \strong{Maintainer}: David Gohel \email{david.gohel@ardata.fr} Authors: \itemize{ \item Panagiotis Skintzos \email{panagiotis.skintzos@ardata.fr} } Other contributors: \itemize{ \item ArData [copyright holder] \item Clementine Jager [contributor] \item Quentin Fazilleau [contributor] \item Maxim Nazarov (rmarkdown for docx output) [contributor] \item Titouan Robert [contributor] \item Michael Barrowman (inline footnotes) [contributor] \item Atsushi Yasumoto (support for bookdown cross reference) [contributor] \item Paul Julian (support for gam objects) [contributor] \item Sean Browning (work on footnote positioning system) [contributor] \item Rémi Thériault (\href{https://orcid.org/0000-0003-4315-6788}{ORCID}) (theme_apa) [contributor] \item Samuel Jobert (work on pagination) [contributor] \item Keith Newman [contributor] } } flextable/man/fontsize.Rd0000644000176200001440000000213314566144245015135 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{fontsize} \alias{fontsize} \title{Set font size} \usage{ fontsize(x, i = NULL, j = NULL, size = 11, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{size}{integer value (points)} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change font size of selected rows and columns of a flextable. } \examples{ ft <- flextable(head(iris)) ft <- fontsize(ft, size = 14, part = "header") ft <- fontsize(ft, size = 14, j = 2) ft <- fontsize(ft, size = 7, j = 3) ft } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()}, \code{\link{valign}()} } \concept{sugar functions for table style} flextable/man/gen_grob.Rd0000644000176200001440000001410714600642517015054 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/grid_grobs.R \name{gen_grob} \alias{gen_grob} \title{Convert a flextable to a grid grob object} \usage{ gen_grob( x, ..., fit = c("auto", "width", "fixed"), scaling = c("min", "full", "fixed"), wrapping = TRUE, autowidths = TRUE, just = NULL ) } \arguments{ \item{x}{A flextable object} \item{...}{Reserved for extra arguments} \item{fit}{Determines the fitting/scaling of the grob on its parent viewport. One of \code{auto}, \code{width}, \code{fixed}, \code{TRUE}, \code{FALSE}: \itemize{ \item \code{auto} or \code{TRUE} (default): The grob is resized to fit in the parent viewport. The table row heights and column widths are resized proportionally. \item \code{width}: The grob is resized horizontally to fit the width of the parent viewport. The column widths are resized proportionally. The row heights are unaffected and the table height may be smaller or larger than the height of the parent viewport. \item \code{fixed} or \code{FALSE}: The grob will have fixed dimensions, as determined by the column widths and the row heights. }} \item{scaling}{Determines the scaling of the table contents. One of \code{min}, \code{full}, \code{fixed}, \code{TRUE}, \code{FALSE}: \itemize{ \item \code{min} or \code{TRUE} (default): When the parent viewport is smaller than the necessary, the various content sizes (text font size, line width and image dimensions) will decrease accordingly so that the content can still fit. When the parent viewport is larger than the necessary, the content sizes will remain the same, they will not increase. \item \code{full}: Same as \code{min}, except that the content sizes are scaled fully, they will increase or decrease, according to the size of the drawing surface. \item \code{fixed} or \code{FALSE}: The content sizes will not be scaled. }} \item{wrapping}{Determines the soft wrapping (line breaking) method for the table cell contents. One of \code{TRUE}, \code{FALSE}: \itemize{ \item \code{TRUE}: Text content may wrap into separate lines at normal word break points (such as a space or tab character between two words) or at newline characters anywhere in the text content. If a word does not fit in the available cell width, then the text content may wrap at any character. Non-text content (such as images) is also wrapped into new lines, according to the available cell width. \item \code{FALSE}: Text content may wrap only with a newline character. Non-text content is not wrapped. } Superscript and subscript chunks do not wrap. Newline and tab characters are removed from these chunk types.} \item{autowidths}{If \code{TRUE} (default) the column widths are adjusted in order to fit the contents of the cells (taking into account the \code{wrapping} setting).} \item{just}{Justification of viewport layout, same as \code{just} argument in \code{\link[grid:grid.layout]{grid::grid.layout()}}. When set to \code{NULL} (default), it is determined according to the \code{fit} argument.} } \value{ a grob (gTree) object made with package \code{grid} } \description{ It uses Grid Graphics (package \code{grid}) to Convert a flextable into a grob object with scaling and text wrapping capabilities. This method can be used to insert a flextable inside a \code{ggplot2} plot, it can also be used with package 'patchwork' or 'cowplot' to combine ggplots and flextables into the same graphic. User can vary the size of the elements according to the size of the graphic window. The text behavior is controllable, user can decide to make the paragraphs (texts and images) distribute themselves correctly in the available space of the cell. It is possible to define resizing options, for example by using only the width, or by distributing the content so that it occupies the whole graphic space. It is also possible to freeze or not the size of the columns. It is not recommended to use this function for large tables because the calculations can be long. Limitations: equations (see \code{\link[=as_equation]{as_equation()}}) and hyperlinks (see \code{\link[=hyperlink_ftext]{hyperlink_ftext()}}) will not be displayed. } \section{size}{ The size of the flextable can be known by using the method \link[=dim.flextableGrob]{dim} on the grob. } \section{caption}{ It's important to note that captions are not part of the table itself. This means when exporting a table to PNG or SVG formats (image formats), the caption won't be included. Captions are intended for document outputs like Word, HTML, or PDF, where tables are embedded within the document itself. } \examples{ \dontshow{ data.table::setDTthreads(1) } library(ragg) library(gdtools) register_liberationsans() set_flextable_defaults(font.family = "Liberation Sans") ft <- flextable(head(mtcars)) gr <- gen_grob(ft) png_f_1 <- tempfile(fileext = ".png") ragg::agg_png( filename = png_f_1, width = 4, height = 2, units = "in", res = 150) plot(gr) dev.off() png_f_2 <- tempfile(fileext = ".png") # get the size dims <- dim(gr) dims ragg::agg_png( filename = png_f_2, width = dims$width + .1, height = dims$height + .1, units = "in", res = 150 ) plot(gr) dev.off() if (require("ggplot2")) { png_f_3 <- tempfile(fileext = ".png") z <- summarizor(iris, by = "Species") |> as_flextable(spread_first_col = TRUE) |> color(color = "gray", part = "all") gg <- ggplot(data = iris, aes(Sepal.Length, Petal.Width)) + annotation_custom( gen_grob(z, scaling = "full"), xmin = 4.5, xmax = 7.5, ymin = 0.25, ymax = 2.25) + geom_point() + theme_minimal() ragg::agg_png( filename = png_f_3, width = 7, height = 7, units = "in", res = 150 ) print(gg) dev.off() } } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/valign.Rd0000644000176200001440000000230414566144245014554 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/styles.R \name{valign} \alias{valign} \title{Set vertical alignment} \usage{ valign(x, i = NULL, j = NULL, valign = "center", part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{valign}{vertical alignment of paragraph within cell, one of "center" or "top" or "bottom".} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change vertical alignment of selected rows and columns of a flextable. } \examples{ ft_1 <- flextable(iris[c(1:3, 51:53, 101:103), ]) ft_1 <- theme_box(ft_1) ft_1 <- merge_v(ft_1, j = 5) ft_1 ft_2 <- valign(ft_1, j = 5, valign = "top", part = "all") ft_2 } \seealso{ Other sugar functions for table style: \code{\link{align}()}, \code{\link{bg}()}, \code{\link{bold}()}, \code{\link{color}()}, \code{\link{empty_blanks}()}, \code{\link{font}()}, \code{\link{fontsize}()}, \code{\link{highlight}()}, \code{\link{italic}()}, \code{\link{keep_with_next}()}, \code{\link{line_spacing}()}, \code{\link{padding}()}, \code{\link{rotate}()}, \code{\link{tab_settings}()} } \concept{sugar functions for table style} flextable/man/shift_table.Rd0000644000176200001440000001231514476430471015562 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/clintables.R \name{shift_table} \alias{shift_table} \title{Create a shift table} \usage{ shift_table( x, cn_visit = "VISIT", cn_visit_num = "VISITNUM", cn_grade = "LBNRIND", cn_usubjid = "USUBJID", cn_lab_cat = NA_character_, cn_is_baseline = "LBBLFL", baseline_identifier = "Y", cn_treatment = NA_character_, grade_levels = c("LOW", "NORMAL", "HIGH"), grade_labels = c("Low", "Normal", "High") ) } \arguments{ \item{x}{Laboratory Tests Results data frame.} \item{cn_visit}{column name containing visit names, default to "VISIT".} \item{cn_visit_num}{column name containing visit numbers, default to "VISITNUM".} \item{cn_grade}{column name containing reference range indicators, default to "LBNRIND".} \item{cn_usubjid}{column name containing unique subject inditifiers, default to "USUBJID".} \item{cn_lab_cat}{column name containing lab tests or examination names, default to "LBTEST".} \item{cn_is_baseline}{column name containing baseline flags, default to "LBBLFL".} \item{baseline_identifier}{baseline flag value to use for baseline identification. Its default is "Y".} \item{cn_treatment}{column name containing treatment names, default to \code{NA}.} \item{grade_levels}{levels to use for reference range indicators} \item{grade_labels}{labels to use for reference range indicators} } \value{ the shift table as a data.frame. Additionnal elements are provided in attributes: \itemize{ \item "VISIT_N": count of unique subject id per visits, labs and eventually treatments. This element is supposed to be used as value for argument \code{hidden_data} of function \code{tabulator()}. \item "FUN_VISIT": a utility function to easily turn \emph{visit} column as a factor column. It should be applied after the shift table creation. \item "FUN_GRADE": a utility function to easily turn \emph{grade} column as a factor column. It adds "MISSING/Missing" and "SUM/Sum" at the end of the set of values specified in arguments \code{grade_levels} and \code{grade_labels}. It should be applied after the shift table creation. } } \description{ Create a shift table ready to be used with \code{tabulator()}. The function is transforming a dataset representing some 'Laboratory Tests Results' structured as \emph{CDISC clinical trial data sets} format to a dataset representing the shift table. Shift tables are tables used in clinical trial analysis. They show the progression of change from the baseline, with the progression often being along time; the number of subjects is displayed in different range (e.g. low, normal, or high) at baseline and at selected time points or intervals. } \examples{ \dontshow{ data.table::setDTthreads(1) } library(data.table) library(flextable) # data simulation ---- USUBJID <- sprintf("01-ABC-\%04.0f", 1:200) VISITS <- c("SCREENING 1", "WEEK 2", "MONTH 3") LBTEST <- c("Albumin", "Sodium") VISITNUM <- seq_along(VISITS) LBBLFL <- rep(NA_character_, length(VISITNUM)) LBBLFL[1] <- "Y" VISIT <- data.frame( VISIT = VISITS, VISITNUM = VISITNUM, LBBLFL = LBBLFL, stringsAsFactors = FALSE ) labdata <- expand.grid( USUBJID = USUBJID, LBTEST = LBTEST, VISITNUM = VISITNUM, stringsAsFactors = FALSE ) setDT(labdata) labdata <- merge(labdata, VISIT, by = "VISITNUM") subject_elts <- unique(labdata[, .SD, .SDcols = "USUBJID"]) subject_elts <- unique(subject_elts) subject_elts[, c("TREAT") := list( sample(x = c("Treatment", "Placebo"), size = .N, replace = TRUE) )] subject_elts[, c("TREAT") := list( factor(.SD$TREAT, levels = c("Treatment", "Placebo")) )] setDF(subject_elts) labdata <- merge(labdata, subject_elts, by = "USUBJID", all.x = TRUE, all.y = FALSE ) labdata[, c("LBNRIND") := list( sample( x = c("LOW", "NORMAL", "HIGH"), size = .N, replace = TRUE, prob = c(.03, .9, .07) ) )] setDF(labdata) # shift table calculation ---- SHIFT_TABLE <- shift_table( x = labdata, cn_visit = "VISIT", cn_grade = "LBNRIND", cn_usubjid = "USUBJID", cn_lab_cat = "LBTEST", cn_treatment = "TREAT", cn_is_baseline = "LBBLFL", baseline_identifier = "Y", grade_levels = c("LOW", "NORMAL", "HIGH") ) # get attrs for post treatment ---- SHIFT_TABLE_VISIT <- attr(SHIFT_TABLE, "VISIT_N") visit_as_factor <- attr(SHIFT_TABLE, "FUN_VISIT") range_as_factor <- attr(SHIFT_TABLE, "FUN_GRADE") # post treatments ---- SHIFT_TABLE$VISIT <- visit_as_factor(SHIFT_TABLE$VISIT) SHIFT_TABLE$BASELINE <- range_as_factor(SHIFT_TABLE$BASELINE) SHIFT_TABLE$LBNRIND <- range_as_factor(SHIFT_TABLE$LBNRIND) SHIFT_TABLE_VISIT$VISIT <- visit_as_factor(SHIFT_TABLE_VISIT$VISIT) # tabulator ---- my_format <- function(z) { formatC(z * 100, digits = 1, format = "f", flag = "0", width = 4 ) } tab <- tabulator( x = SHIFT_TABLE, hidden_data = SHIFT_TABLE_VISIT, row_compose = list( VISIT = as_paragraph(VISIT, "\n(N=", N_VISIT, ")") ), rows = c("LBTEST", "VISIT", "BASELINE"), columns = c("TREAT", "LBNRIND"), `n` = as_paragraph(N), `\%` = as_paragraph(as_chunk(PCT, formatter = my_format)) ) # as_flextable ---- ft_1 <- as_flextable( x = tab, separate_with = "VISIT", label_rows = c( LBTEST = "Lab Test", VISIT = "Visit", BASELINE = "Reference Range Indicator" ) ) ft_1 } \concept{tools for clinical reporting} flextable/man/proc_freq.Rd0000644000176200001440000000240314410655214015243 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/proc_freq.R \name{proc_freq} \alias{proc_freq} \title{Frequency table} \usage{ proc_freq( x, row = character(), col = character(), include.row_percent = TRUE, include.column_percent = TRUE, include.table_percent = TRUE, weight = character(), ... ) } \arguments{ \item{x}{a \code{data.frame} object containing variable(s) to use for counts.} \item{row}{\code{characer} column names for row} \item{col}{\code{characer} column names for column} \item{include.row_percent}{\code{boolean} whether to include the row percents; defaults to \code{TRUE}} \item{include.column_percent}{\code{boolean} whether to include the column percents; defaults to \code{TRUE}} \item{include.table_percent}{\code{boolean} whether to include the table percents; defaults to \code{TRUE}} \item{weight}{\code{character} column name for weight} \item{...}{unused arguments} } \description{ This function compute a one or two way contingency table and create a flextable from the result. The function is largely inspired by "PROC FREQ" from "SAS" and was written with the intent to make it as compact as possible. } \examples{ proc_freq(mtcars, "vs", "gear") proc_freq(mtcars, "gear", "vs", weight = "wt") } flextable/man/save_as_docx.Rd0000644000176200001440000000350014515040434015716 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{save_as_docx} \alias{save_as_docx} \title{Save flextable objects in a 'Word' file} \usage{ save_as_docx(..., values = NULL, path, pr_section = NULL, align = "center") } \arguments{ \item{...}{flextable objects, objects, possibly named. If named objects, names are used as titles.} \item{values}{a list (possibly named), each element is a flextable object. If named objects, names are used as titles. If provided, argument \code{...} will be ignored.} \item{path}{Word file to be created} \item{pr_section}{a \link{prop_section} object that can be used to define page layout such as orientation, width and height.} \item{align}{left, center (default) or right.} } \value{ a string containing the full name of the generated file } \description{ sugar function to save flextable objects in an Word file. } \examples{ tf <- tempfile(fileext = ".docx") library(officer) ft1 <- flextable(head(iris)) save_as_docx(ft1, path = tf) ft2 <- flextable(head(mtcars)) sect_properties <- prop_section( page_size = page_size( orient = "landscape", width = 8.3, height = 11.7 ), type = "continuous", page_margins = page_mar() ) save_as_docx( `iris table` = ft1, `mtcars table` = ft2, path = tf, pr_section = sect_properties ) } \seealso{ \code{\link[=paginate]{paginate()}} Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{flextable_to_rmd}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/fp_text_default.Rd0000644000176200001440000000646014476430471016457 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{fp_text_default} \alias{fp_text_default} \title{Text formatting properties} \usage{ fp_text_default( color = flextable_global$defaults$font.color, font.size = flextable_global$defaults$font.size, bold = FALSE, italic = FALSE, underlined = FALSE, font.family = flextable_global$defaults$font.family, cs.family = NULL, eastasia.family = NULL, hansi.family = NULL, vertical.align = "baseline", shading.color = "transparent" ) } \arguments{ \item{color}{font color - a single character value specifying a valid color (e.g. "#000000" or "black").} \item{font.size}{font size (in point) - 0 or positive integer value.} \item{bold}{is bold} \item{italic}{is italic} \item{underlined}{is underlined} \item{font.family}{single character value. Specifies the font to be used to format characters in the Unicode range (U+0000-U+007F).} \item{cs.family}{optional font to be used to format characters in a complex script Unicode range. For example, Arabic text might be displayed using the "Arial Unicode MS" font.} \item{eastasia.family}{optional font to be used to format characters in an East Asian Unicode range. For example, Japanese text might be displayed using the "MS Mincho" font.} \item{hansi.family}{optional. Specifies the font to be used to format characters in a Unicode range which does not fall into one of the other categories.} \item{vertical.align}{single character value specifying font vertical alignments. Expected value is one of the following : default \code{'baseline'} or \code{'subscript'} or \code{'superscript'}} \item{shading.color}{shading color - a single character value specifying a valid color (e.g. "#000000" or "black").} } \description{ Create a \code{\link[=fp_text]{fp_text()}} object that uses defaut values defined in the flextable it applies to. \code{fp_text_default()} is a handy function that will allow you to specify certain formatting values to be applied to a piece of text, the formatting values that are not specified will simply be the existing formatting values. For example, if you set the text in the cell to red previously, using the code \code{fp_text_default(bold = TRUE)}, the formatting will be 'bold' but it will also be 'red'. On the other hand, the \code{fp_text()} function forces you to specify all the parameters, so we strongly recommend working with \code{fp_text_default()} which was created to replace the use of the former. See also \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} to modify flextable defaults formatting properties. } \examples{ library(flextable) set_flextable_defaults( font.size = 11, font.color = "#303030", padding = 3, table.layout = "autofit" ) z <- flextable(head(cars)) z <- compose( x = z, i = ~ speed < 6, j = "speed", value = as_paragraph( as_chunk("slow... ", props = fp_text_default(color = "red")), as_chunk(speed, props = fp_text_default(italic = TRUE)) ) ) z init_flextable_defaults() } \seealso{ \code{\link[=as_chunk]{as_chunk()}}, \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}}, \code{\link[=prepend_chunks]{prepend_chunks()}} Other functions for defining formatting properties: \code{\link{fp_border_default}()} } \concept{functions for defining formatting properties} flextable/man/surround.Rd0000644000176200001440000000457614565457154015177 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{surround} \alias{surround} \title{Set borders for a selection of cells} \usage{ surround( x, i = NULL, j = NULL, border = NULL, border.top = NULL, border.bottom = NULL, border.left = NULL, border.right = NULL, part = "body" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{border}{border (shortcut for top, bottom, left and right)} \item{border.top}{border top} \item{border.bottom}{border bottom} \item{border.left}{border left} \item{border.right}{border right} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ Highlight specific cells with borders. To set borders for the whole table, use \code{\link[=border_outer]{border_outer()}}, \code{\link[=border_inner_h]{border_inner_h()}} and \code{\link[=border_inner_v]{border_inner_v()}}. All the following functions also support the row and column selector \code{i} and \code{j}: \itemize{ \item \code{\link[=hline]{hline()}}: set bottom borders (inner horizontal) \item \code{\link[=vline]{vline()}}: set right borders (inner vertical) \item \code{\link[=hline_top]{hline_top()}}: set the top border (outer horizontal) \item \code{\link[=vline_left]{vline_left()}}: set the left border (outer vertical) } } \examples{ library(officer) library(flextable) # cell to highlight vary_i <- 1:3 vary_j <- 1:3 std_border <- fp_border(color = "orange") ft <- flextable(head(iris)) ft <- border_remove(x = ft) ft <- border_outer(x = ft, border = std_border) for (id in seq_along(vary_i)) { ft <- bg( x = ft, i = vary_i[id], j = vary_j[id], bg = "yellow" ) ft <- surround( x = ft, i = vary_i[id], j = vary_j[id], border.left = std_border, border.right = std_border, part = "body" ) } ft <- autofit(ft) ft # # render # print(ft, preview = "pptx") # print(ft, preview = "docx") # print(ft, preview = "pdf") # print(ft, preview = "html") } \seealso{ Other borders management: \code{\link{border_inner}()}, \code{\link{border_inner_h}()}, \code{\link{border_inner_v}()}, \code{\link{border_outer}()}, \code{\link{border_remove}()}, \code{\link{hline}()}, \code{\link{hline_bottom}()}, \code{\link{hline_top}()}, \code{\link{vline}()}, \code{\link{vline_left}()}, \code{\link{vline_right}()} } \concept{borders management} flextable/man/fmt_signif_after_zeros.Rd0000644000176200001440000000210314570173725020021 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarizor.R \name{fmt_signif_after_zeros} \alias{fmt_signif_after_zeros} \title{Format with significant figures after zeros} \usage{ fmt_signif_after_zeros(x, digits = 3) } \arguments{ \item{x}{numeric values} \item{digits}{number of digits displayed after the leading zeros} } \description{ Rounds significant figures after zeros in numeric vectors. The number of digits displayed after the leading zeros is customizable using the \code{digits} parameter. } \examples{ x <- data.frame( x = c(0.00000004567, 2.000003456, 3, pi) ) ft_1 <- flextable(x) ft_1 <- align(x = ft_1, j = 1, align = "left") mk_par(ft_1, value = as_paragraph( fmt_signif_after_zeros(x))) } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=mk_par]{mk_par()}} Other text formatter functions: \code{\link{fmt_2stats}()}, \code{\link{fmt_avg_dev}()}, \code{\link{fmt_dbl}()}, \code{\link{fmt_header_n}()}, \code{\link{fmt_int}()}, \code{\link{fmt_n_percent}()}, \code{\link{fmt_pct}()} } \concept{text formatter functions} flextable/man/flextable_to_rmd.Rd0000644000176200001440000000304114601331715016573 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/printers.R \name{flextable_to_rmd} \alias{flextable_to_rmd} \title{Knitr rendering in loops and if statements} \usage{ flextable_to_rmd(x, ...) } \arguments{ \item{x}{a flextable object} \item{...}{unused argument} } \description{ Print flextable in R Markdown or Quarto documents within \code{for} loop or \code{if} statement. The function is particularly useful when you want to generate flextable in a loop from a R Markdown document. Inside R Markdown document, chunk option \code{results} must be set to 'asis'. See \link{knit_print.flextable} for more details. } \examples{ \dontrun{ library(rmarkdown) if (pandoc_available() && pandoc_version() > numeric_version("2")) { demo_loop <- system.file( package = "flextable", "examples/rmd", "loop_with_flextable.Rmd" ) rmd_file <- tempfile(fileext = ".Rmd") file.copy(demo_loop, to = rmd_file, overwrite = TRUE) render( input = rmd_file, output_format = "html_document", output_file = "loop_with_flextable.html" ) } } } \seealso{ Other flextable print function: \code{\link{as_raster}()}, \code{\link{df_printer}()}, \code{\link{gen_grob}()}, \code{\link{htmltools_value}()}, \code{\link{knit_print.flextable}()}, \code{\link{plot.flextable}()}, \code{\link{print.flextable}()}, \code{\link{save_as_docx}()}, \code{\link{save_as_html}()}, \code{\link{save_as_image}()}, \code{\link{save_as_pptx}()}, \code{\link{save_as_rtf}()}, \code{\link{to_html.flextable}()} } \concept{flextable print function} flextable/man/add_header_row.Rd0000644000176200001440000000437214565457153016236 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_header_row} \alias{add_header_row} \title{Add header labels} \usage{ add_header_row(x, top = TRUE, values = character(0), colwidths = integer(0)) } \arguments{ \item{x}{a flextable object} \item{top}{should the row be inserted at the top or the bottom. Default to TRUE.} \item{values}{values to add, a character vector (as header rows contains only character values/columns), a list or a call to \code{\link[=as_paragraph]{as_paragraph()}}.} \item{colwidths}{the number of columns used for each label} } \description{ Add a row of new columns labels in header part. Labels can be spanned along multiple columns, as merged cells. Labels are associated with a number of columns to merge that default to one if not specified. In this case, you have to make sure that the number of labels is equal to the number of columns displayed. The function can add only one single row by call. Labels can also be formatted with \code{\link[=as_paragraph]{as_paragraph()}}. } \examples{ library(flextable) ft01 <- fp_text_default(color = "red") ft02 <- fp_text_default(color = "orange") pars <- as_paragraph( as_chunk(c("(1)", "(2)"), props = ft02), " ", as_chunk(c( "My tailor is rich", "My baker is rich" ), props = ft01) ) ft_1 <- flextable(head(mtcars)) ft_1 <- add_header_row(ft_1, values = pars, colwidths = c(5, 6), top = FALSE ) ft_1 <- add_header_row(ft_1, values = pars, colwidths = c(3, 8), top = TRUE ) ft_1 ft_2 <- flextable(head(airquality)) ft_2 <- add_header_row(ft_2, values = c("Measure", "Time"), colwidths = c(4, 2), top = TRUE ) ft_2 <- theme_box(ft_2) ft_2 } \seealso{ \code{\link[=flextable]{flextable()}}, \code{\link[=set_caption]{set_caption()}} Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/body_replace_flextable_at_bkm.Rd0000644000176200001440000000135714440663650021273 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/body_add_flextable.R \name{body_replace_flextable_at_bkm} \alias{body_replace_flextable_at_bkm} \title{Add flextable at boorkmark location in a Word document} \usage{ body_replace_flextable_at_bkm( x, bookmark, value, align = "center", split = FALSE ) } \arguments{ \item{x}{an rdocx object} \item{bookmark}{bookmark id} \item{value}{\code{flextable} object} \item{align}{left, center (default) or right.} \item{split}{set to TRUE if you want to activate Word option 'Allow row to break across pages'.} } \description{ Use this function if you want to replace a paragraph containing a bookmark with a flextable. As a side effect, the bookmark will be lost. } flextable/man/theme_tron_legacy.Rd0000644000176200001440000000372514364612403016764 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_tron_legacy} \alias{theme_tron_legacy} \title{Apply tron legacy theme} \usage{ theme_tron_legacy(x) } \arguments{ \item{x}{a flextable object} } \description{ Apply theme tron legacy to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_tron_legacy(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/add_latex_dep.Rd0000644000176200001440000000131214375473105016045 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/latex_str.R \name{add_latex_dep} \alias{add_latex_dep} \title{Add latex dependencies} \usage{ add_latex_dep(float = FALSE, wrapfig = FALSE) } \arguments{ \item{float}{load package 'float'} \item{wrapfig}{load package 'wrapfig'} } \description{ Manually add flextable latex dependencies to the knitr session via \code{\link[=knit_meta_add]{knit_meta_add()}}. When enabling caching in 'R Markdown' documents for PDF output, the flextable cached result is used directly. Call \code{add_latex_dep()} in a non cached chunk so that flextable latex dependencies are added to knitr metadata. } \examples{ add_latex_dep() } \keyword{internal} flextable/man/theme_tron.Rd0000644000176200001440000000366214364612403015440 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_tron} \alias{theme_tron} \title{Apply tron theme} \usage{ theme_tron(x) } \arguments{ \item{x}{a flextable object} } \description{ Apply theme tron to a flextable } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_tron(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_alafoli}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/labelizor.Rd0000644000176200001440000000246014476430471015261 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/compose.R \name{labelizor} \alias{labelizor} \title{Change displayed labels} \usage{ labelizor(x, j = NULL, labels, part = "all") } \arguments{ \item{x}{a flextable object} \item{j}{columns selection} \item{labels}{a named vector whose names will be used to identify values to replace and values will be used as labels.} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ The function replace text values in a flextable with labels. The labels are defined with character named vector. The function is not written to be fast but to be handy. It does not replace the values in the underlying dataset but replace the defined content in the flextable (as defined with \code{\link[=compose]{compose()}}). } \examples{ \dontshow{ data.table::setDTthreads(1) } z <- summarizor( x = CO2[-c(1, 4)], by = "Treatment", overall_label = "Overall" ) ft_1 <- as_flextable(z, separate_with = "variable") ft_1 <- labelizor( x = ft_1, j = c("stat"), labels = c(Missing = "Kouign amann") ) ft_1 <- labelizor( x = ft_1, j = c("variable"), labels = toupper ) ft_1 } \seealso{ \code{\link[=mk_par]{mk_par()}}, \code{\link[=append_chunks]{append_chunks()}}, \code{\link[=prepend_chunks]{prepend_chunks()}} } flextable/man/merge_at.Rd0000644000176200001440000000143514565457154015070 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/merge_flextable.R \name{merge_at} \alias{merge_at} \title{Merge flextable cells into a single one} \usage{ merge_at(x, i = NULL, j = NULL, part = "body") } \arguments{ \item{x}{\code{flextable} object} \item{i, j}{columns and rows to merge} \item{part}{partname of the table where merge has to be done.} } \description{ Merge flextable cells into a single one. All rows and columns must be consecutive. } \examples{ ft_merge <- flextable(head(mtcars), cwidth = .5) ft_merge <- merge_at(ft_merge, i = 1:2, j = 1:2) ft_merge } \seealso{ Other flextable merging function: \code{\link{merge_h}()}, \code{\link{merge_h_range}()}, \code{\link{merge_none}()}, \code{\link{merge_v}()} } \concept{flextable merging function} flextable/man/tabulator_colnames.Rd0000644000176200001440000000563614375471155017166 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/as_flextable_tabulator.R \name{tabulator_colnames} \alias{tabulator_colnames} \title{Column keys of tabulator objects} \usage{ tabulator_colnames(x, columns, ..., type = NULL) } \arguments{ \item{x}{a \code{\link[=tabulator]{tabulator()}} object} \item{columns}{column names to look for} \item{...}{any filter conditions that use variables names, the same than the argument \code{columns} of function \code{\link[=tabulator]{tabulator()}} (\code{tabulator(columns = c("col1", "col2"))}).} \item{type}{the type of column to look for, it can be: \itemize{ \item 'columns': visible columns, corresponding to names provided in the '...' arguments of your call to 'tabulator()'. \item 'hidden': unvisible columns, corresponding to names of the original dataset columns. \item 'rows': visible columns used as 'row' content \item 'rows_supp': visible columns used as 'rows_supp' content \item NULL: any type of column }} } \description{ The function provides a way to get column keys associated with the flextable corresponding to a \code{\link[=tabulator]{tabulator()}} object. It helps in customizing or programing with \code{tabulator}. The function is using column names from the original dataset, eventually filters and returns the names corresponding to the selection. } \examples{ library(flextable) cancer_dat <- data.frame( count = c( 9L, 5L, 1L, 2L, 2L, 1L, 9L, 3L, 1L, 10L, 2L, 1L, 1L, 2L, 0L, 3L, 2L, 1L, 1L, 2L, 0L, 12L, 4L, 1L, 7L, 3L, 1L, 5L, 5L, 3L, 10L, 4L, 1L, 4L, 2L, 0L, 3L, 1L, 0L, 4L, 4L, 2L, 42L, 28L, 19L, 26L, 19L, 11L, 12L, 10L, 7L, 10L, 5L, 6L, 5L, 0L, 3L, 4L, 3L, 3L, 1L, 2L, 3L ), risktime = c( 157L, 77L, 21L, 139L, 68L, 17L, 126L, 63L, 14L, 102L, 55L, 12L, 88L, 50L, 10L, 82L, 45L, 8L, 76L, 42L, 6L, 134L, 71L, 22L, 110L, 63L, 18L, 96L, 58L, 14L, 86L, 42L, 10L, 66L, 35L, 8L, 59L, 32L, 8L, 51L, 28L, 6L, 212L, 130L, 101L, 136L, 72L, 63L, 90L, 42L, 43L, 64L, 21L, 32L, 47L, 14L, 21L, 39L, 13L, 14L, 29L, 7L, 10L ), time = rep(as.character(1:7), 3), histology = rep(as.character(1:3), 21), stage = rep(as.character(1:3), each = 21) ) datasup_first <- data.frame( time = factor(1:7, levels = 1:7), zzz = runif(7) ) z <- tabulator(cancer_dat, rows = "time", columns = c("histology", "stage"), datasup_first = datasup_first, n = as_paragraph(as_chunk(count)) ) j <- tabulator_colnames( x = z, type = "columns", columns = c("n"), stage \%in\% 1 ) src <- tabulator_colnames( x = z, type = "hidden", columns = c("count"), stage \%in\% 1 ) if (require("scales")) { colourer <- col_numeric( palette = c("wheat", "red"), domain = c(0, 45) ) ft_1 <- as_flextable(z) ft_1 <- bg( ft_1, bg = colourer, part = "body", j = j, source = src ) ft_1 } } \seealso{ \code{\link[=tabulator]{tabulator()}}, \code{\link[=as_flextable.tabulator]{as_flextable.tabulator()}} } flextable/man/regulartable.Rd0000644000176200001440000000141214255321756015743 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/flextable.R \name{regulartable} \alias{regulartable} \title{flextable old functions} \usage{ regulartable(data, col_keys = names(data), cwidth = 0.75, cheight = 0.25) } \arguments{ \item{data}{dataset} \item{col_keys}{columns names/keys to display. If some column names are not in the dataset, they will be added as blank columns by default.} \item{cwidth, cheight}{initial width and height to use for cell sizes in inches.} } \description{ The function is maintained for compatibility with old codes mades by users but be aware it produces the same exact object than \code{\link[=flextable]{flextable()}}. This function should be deprecated then removed in the next versions. } \keyword{internal} flextable/man/as_word_field.Rd0000644000176200001440000000605514565457153016110 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/05_content.R \name{as_word_field} \alias{as_word_field} \title{'Word' computed field} \usage{ as_word_field(x, props = NULL, width = 0.1, height = 0.15, unit = "in") } \arguments{ \item{x}{computed field strings} \item{props}{text properties (see \code{\link[=fp_text_default]{fp_text_default()}} or \code{\link[officer:fp_text]{officer::fp_text()}}) object to be used to format the text. If not specified, it will use the default text properties of the cell(s).} \item{width, height}{size computed field} \item{unit}{unit for width and height, one of "in", "cm", "mm".} } \description{ This function is used to insert 'Word' computed field into flextable. It is used to add it to the content of a cell of the flextable with the functions \code{\link[=compose]{compose()}}, \code{\link[=append_chunks]{append_chunks()}} or \code{\link[=prepend_chunks]{prepend_chunks()}}. This has only effect on 'Word' output. If you want to condition its execution only for Word output, you can use it in the post processing step (see \code{set_flextable_defaults(post_process_docx = ...)}) \strong{Do not forget to update the computed field in Word}. Fields are defined but are not computed, this computing is an operation that has to be made by 'Microsoft Word' (select all text and hit \code{F9} when on mac os). } \examples{ library(flextable) # define some default values ---- set_flextable_defaults(font.size = 22, border.color = "gray") # an example with append_chunks ---- pp_docx <- function(x) { x <- add_header_lines(x, "Page ") x <- append_chunks( x = x, i = 1, part = "header", j = 1, as_word_field(x = "Page") ) align(x, part = "header", align = "left") } ft_1 <- flextable(cars) ft_1 <- autofit(ft_1) ft_1 <- pp_docx(ft_1) ## or: # set_flextable_defaults(post_process_docx = pp_docx) ## to prevent this line addition when output is not docx # print(ft_1, preview = "docx") # an example with compose ---- library(officer) ft_2 <- flextable(head(cars)) ft_2 <- add_footer_lines(ft_2, "temp text") ft_2 <- compose( x = ft_2, part = "footer", i = 1, j = 1, as_paragraph( "p. ", as_word_field(x = "Page", width = .05), " on ", as_word_field(x = "NumPages", width = .05) ) ) ft_2 <- autofit(ft_2, part = c("header", "body")) doc <- read_docx() doc <- body_add_flextable(doc, ft_2) doc <- body_add_break(doc) doc <- body_add_flextable(doc, ft_2) outfile <- print(doc, target = tempfile(fileext = ".docx")) # reset default values ---- init_flextable_defaults() } \seealso{ Other chunk elements for paragraph: \code{\link{as_b}()}, \code{\link{as_bracket}()}, \code{\link{as_chunk}()}, \code{\link{as_equation}()}, \code{\link{as_highlight}()}, \code{\link{as_i}()}, \code{\link{as_image}()}, \code{\link{as_sub}()}, \code{\link{as_sup}()}, \code{\link{colorize}()}, \code{\link{gg_chunk}()}, \code{\link{grid_chunk}()}, \code{\link{hyperlink_text}()}, \code{\link{linerange}()}, \code{\link{lollipop}()}, \code{\link{minibar}()}, \code{\link{plot_chunk}()} } \concept{chunk elements for paragraph} flextable/man/theme_alafoli.Rd0000644000176200001440000000366214565457154016102 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/themes.R \name{theme_alafoli} \alias{theme_alafoli} \title{Apply alafoli theme} \usage{ theme_alafoli(x) } \arguments{ \item{x}{a flextable object} } \description{ Apply alafoli theme } \section{behavior}{ Theme functions are not like 'ggplot2' themes. They are applied to the existing table \strong{immediately}. If you add a row in the footer, the new row is not formatted with the theme. The theme function applies the theme only to existing elements when the function is called. That is why theme functions should be applied after all elements of the table have been added (mainly additionnal header or footer rows). If you want to automatically apply a theme function to each flextable, you can use the \code{theme_fun} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}; be aware that this theme function is applied as the last instruction when calling \code{flextable()} - so if you add headers or footers to the array, they will not be formatted with the theme. You can also use the \code{post_process_html} argument of \code{\link[=set_flextable_defaults]{set_flextable_defaults()}} (or \code{post_process_pdf}, \code{post_process_docx}, \code{post_process_pptx}) to specify a theme to be applied systematically before the \code{flextable()} is printed; in this case, don't forget to take care that the theme doesn't override any formatting done before the print statement. } \examples{ ft <- flextable(head(airquality)) ft <- theme_alafoli(ft) ft } \seealso{ Other functions related to themes: \code{\link{get_flextable_defaults}()}, \code{\link{set_flextable_defaults}()}, \code{\link{theme_apa}()}, \code{\link{theme_booktabs}()}, \code{\link{theme_box}()}, \code{\link{theme_tron}()}, \code{\link{theme_tron_legacy}()}, \code{\link{theme_vader}()}, \code{\link{theme_vanilla}()}, \code{\link{theme_zebra}()} } \concept{functions related to themes} flextable/man/border.Rd0000644000176200001440000000415214476430470014552 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{border} \alias{border} \title{Cell borders update} \usage{ border( x, i = NULL, j = NULL, border = NULL, border.top = NULL, border.bottom = NULL, border.left = NULL, border.right = NULL, part = "body" ) } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{border}{border (shortcut for top, bottom, left and right)} \item{border.top}{border top} \item{border.bottom}{border bottom} \item{border.left}{border left} \item{border.right}{border right} \item{part}{partname of the table (one of 'all', 'body', 'header', 'footer')} } \description{ change borders of selected rows and columns of a flextable. This function is not to be used by end user (it requires careful settings to avoid overlapping borders) but only for programming purposes. If you need to add borders, use instead other functions: These set borders for the whole table : \code{\link[=border_outer]{border_outer()}}, \code{\link[=border_inner_h]{border_inner_h()}} and \code{\link[=border_inner_v]{border_inner_v()}}. To add horizontal or vertical lines in the table at specific location, use: \itemize{ \item \code{\link[=hline]{hline()}}: set bottom borders (inner horizontal) \item \code{\link[=vline]{vline()}}: set right borders (inner vertical) } To add following horizontal or vertical lines at beginning or end of the table, use: \itemize{ \item \code{\link[=hline_top]{hline_top()}}: set the top border (outer horizontal) \item \code{\link[=hline_bottom]{hline_bottom()}}: set the bottom border (outer horizontal) \item \code{\link[=vline_left]{vline_left()}}: set the left border (outer vertical) \item \code{\link[=vline_right]{vline_right()}}: set the right border (outer vertical) } If you want to highlight specific cells with some borders, use \code{\link[=surround]{surround()}}. } \note{ pdf and pptx outputs do not support \code{border()} usage. } \examples{ library(officer) ftab <- flextable(head(mtcars)) ftab <- border(ftab, border.top = fp_border(color = "orange")) ftab } \keyword{internal} flextable/man/add_header.Rd0000644000176200001440000000517114565457153015345 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/augment_rows.R \name{add_header} \alias{add_header} \title{Add column values as new lines in header} \usage{ add_header(x, top = TRUE, ..., values = NULL) } \arguments{ \item{x}{a flextable object} \item{top}{should the rows be inserted at the top or the bottom.} \item{...}{named arguments (names are data colnames) of values to add. It is important to insert data of the same type as the original data, otherwise it will be transformed (probably into strings if you add a \code{character} where a \code{double} is expected). This makes possible to still format cell contents with the \verb{colformat_*} functions, for example \code{\link[=colformat_num]{colformat_num()}}.} \item{values}{a list of name-value pairs of labels or values, names should be existing col_key values. This argument can be used instead of \code{...} for programming purpose (If \code{values} is supplied argument \code{...} is ignored).} } \description{ The function adds a list of values to be inserted as new rows in the header. The values are inserted in existing columns of the input data of the flextable. Rows can be inserted at the top or the bottom of the header. If some columns are not provided, they will be replaced by \code{NA} and displayed as empty. \if{html}{\out{ add_header illustration }} } \note{ when repeating values, they can be merged together with function \code{\link[=merge_h]{merge_h()}} and \code{\link[=merge_v]{merge_v()}}. } \examples{ library(flextable) fun <- function(x) { paste0( c("min: ", "max: "), formatC(range(x)) ) } new_row <- list( Sepal.Length = fun(iris$Sepal.Length), Sepal.Width = fun(iris$Sepal.Width), Petal.Width = fun(iris$Petal.Width), Petal.Length = fun(iris$Petal.Length) ) ft_1 <- flextable(data = head(iris)) ft_1 <- add_header(ft_1, values = new_row, top = FALSE) ft_1 <- append_chunks(ft_1, part = "header", i = 2, ) ft_1 <- theme_booktabs(ft_1, bold_header = TRUE) ft_1 <- align(ft_1, align = "center", part = "all") ft_1 } \seealso{ Other functions for row and column operations in a flextable: \code{\link{add_body}()}, \code{\link{add_body_row}()}, \code{\link{add_footer}()}, \code{\link{add_footer_lines}()}, \code{\link{add_footer_row}()}, \code{\link{add_header_row}()}, \code{\link{delete_columns}()}, \code{\link{delete_part}()}, \code{\link{delete_rows}()}, \code{\link{separate_header}()}, \code{\link{set_header_footer_df}}, \code{\link{set_header_labels}()} } \concept{functions for row and column operations in a flextable} flextable/man/fp_border_default.Rd0000644000176200001440000000250114565457154016746 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{fp_border_default} \alias{fp_border_default} \title{Border formatting properties} \usage{ fp_border_default( color = flextable_global$defaults$border.color, style = "solid", width = flextable_global$defaults$border.width ) } \arguments{ \item{color}{border color - single character value (e.g. "#000000" or "black")} \item{style}{border style - single character value : See Details for supported border styles.} \item{width}{border width - an integer value : 0>= value} } \description{ Create a \code{\link[=fp_border]{fp_border()}} object that uses defaut values defined in flextable defaults formatting properties, i.e. default border color (see \code{\link[=set_flextable_defaults]{set_flextable_defaults()}}). } \examples{ library(flextable) set_flextable_defaults( border.color = "orange" ) z <- flextable(head(cars)) z <- theme_vanilla(z) z <- vline( z, j = 1, part = "all", border = officer::fp_border() ) z <- vline( z, j = 2, part = "all", border = fp_border_default() ) z init_flextable_defaults() } \seealso{ \code{\link[=hline]{hline()}}, \code{\link[=vline]{vline()}} Other functions for defining formatting properties: \code{\link{fp_text_default}()} } \concept{functions for defining formatting properties} flextable/DESCRIPTION0000644000176200001440000000656614615774006013755 0ustar liggesusersType: Package Package: flextable Title: Functions for Tabular Reporting Version: 0.9.6 Authors@R: c( person("David", "Gohel", , "david.gohel@ardata.fr", role = c("aut", "cre")), person("ArData", role = "cph"), person("Clementine", "Jager", role = "ctb"), person("Panagiotis", "Skintzos", , "panagiotis.skintzos@ardata.fr", role = "aut"), person("Quentin", "Fazilleau", role = "ctb"), person("Maxim", "Nazarov", role = "ctb", comment = "rmarkdown for docx output"), person("Titouan", "Robert", role = "ctb"), person("Michael", "Barrowman", role = "ctb", comment = "inline footnotes"), person("Atsushi", "Yasumoto", role = "ctb", comment = "support for bookdown cross reference"), person("Paul", "Julian", role = "ctb", comment = "support for gam objects"), person("Sean", "Browning", role = "ctb", comment = "work on footnote positioning system"), person("Rémi", "Thériault", role = "ctb", comment = c(ORCID = "0000-0003-4315-6788", ctb = "theme_apa")), person("Samuel", "Jobert", role = "ctb", comment = "work on pagination"), person("Keith", "Newman", role = "ctb") ) Description: Use a grammar for creating and customizing pretty tables. The following formats are supported: 'HTML', 'PDF', 'RTF', 'Microsoft Word', 'Microsoft PowerPoint' and R 'Grid Graphics'. 'R Markdown', 'Quarto' and the package 'officer' can be used to produce the result files. The syntax is the same for the user regardless of the type of output to be produced. A set of functions allows the creation, definition of cell arrangement, addition of headers or footers, formatting and definition of cell content with text and or images. The package also offers a set of high-level functions that allow tabular reporting of statistical models and the creation of complex cross tabulations. License: GPL-3 URL: https://ardata-fr.github.io/flextable-book/, https://davidgohel.github.io/flextable/ BugReports: https://github.com/davidgohel/flextable/issues Imports: data.table (>= 1.13.0), gdtools (>= 0.3.6), graphics, grDevices, grid, htmltools, knitr, officer (>= 0.6.5), ragg, rlang, rmarkdown (>= 2.0), stats, utils, uuid (>= 0.1-4), xml2 Suggests: bookdown (>= 0.34), broom, broom.mixed, chromote, cluster, commonmark, doconv (>= 0.3.0), equatags, ggplot2, lme4, magick, mgcv, nlme, officedown, pdftools, pkgdown (>= 2.0.0), scales, svglite, tables (>= 0.9.17), testthat (>= 3.0.0), webshot2, withr, xtable VignetteBuilder: knitr Config/testthat/edition: 3 Encoding: UTF-8 RoxygenNote: 7.3.1 NeedsCompilation: no Packaged: 2024-05-05 08:15:51 UTC; davidgohel Author: David Gohel [aut, cre], ArData [cph], Clementine Jager [ctb], Panagiotis Skintzos [aut], Quentin Fazilleau [ctb], Maxim Nazarov [ctb] (rmarkdown for docx output), Titouan Robert [ctb], Michael Barrowman [ctb] (inline footnotes), Atsushi Yasumoto [ctb] (support for bookdown cross reference), Paul Julian [ctb] (support for gam objects), Sean Browning [ctb] (work on footnote positioning system), Rémi Thériault [ctb] (, theme_apa), Samuel Jobert [ctb] (work on pagination), Keith Newman [ctb] Maintainer: David Gohel Repository: CRAN Date/Publication: 2024-05-05 21:20:06 UTC flextable/build/0000755000176200001440000000000014615640064013325 5ustar liggesusersflextable/build/vignette.rds0000644000176200001440000000031514615640064015663 0ustar liggesusersb```b`a@&0`b fd`a flextable::font(fontname = "Liberation Sans", part = "body") # R Markdown with pdflatex knitr::opts_knit$set("quarto.version" = NULL) latex_str <- flextable:::gen_raw_latex(ft, quarto = FALSE) expect_no_match(latex_str, regexp = "Liberation Sans", fixed = TRUE) knitr::opts_knit$set("rmarkdown.pandoc.args" = c("--pdf-engine", "xelatex")) latex_str <- flextable:::gen_raw_latex(ft, quarto = FALSE) expect_match(latex_str, regexp = "Liberation Sans", fixed = TRUE) knitr::opts_knit$set("rmarkdown.pandoc.args" = NULL) # quarto flextable:::fake_quarto() latex_str <- flextable:::gen_raw_latex(ft, quarto = TRUE) expect_match(latex_str, regexp = "Liberation Sans", fixed = TRUE) }) flextable/tests/testthat/test-padding.R0000644000176200001440000000155214615445170017742 0ustar liggesuserstest_that("padding overwrite all paddings", { ft <- flextable(data.frame(a = c("", ""), stringsAsFactors = FALSE)) ft <- padding(ft, padding = 5) new_paddings <- c( ft$body$styles$pars$padding.bottom$data[, ], ft$body$styles$pars$padding.top$data[, ], ft$body$styles$pars$padding.left$data[, ], ft$body$styles$pars$padding.right$data[, ] ) new_paddings <- unique(new_paddings) expect_equal(new_paddings, 5) }) test_that("padding overwrite all paddings but not missing", { ft <- flextable(iris) ft <- padding(ft, padding = 5, padding.top = 20) new_paddings <- c( ft$body$styles$pars$padding.bottom$data[, ], ft$body$styles$pars$padding.top$data[, ], ft$body$styles$pars$padding.left$data[, ], ft$body$styles$pars$padding.right$data[, ] ) new_paddings <- unique(new_paddings) expect_equal(new_paddings, c(5, 20)) }) flextable/tests/testthat/setup.R0000644000176200001440000001042314577125770016524 0ustar liggesusers# Collection of functions and data pre-processing to help with testing library(officer) library(xml2) # xml related functions -------------------------------------------------------- get_docx_xml <- function(x) { if (inherits(x, "flextable")) { docx_file <- tempfile(fileext = ".docx") doc <- read_docx() doc <- body_add_flextable(doc, value = x) print(doc, target = docx_file) x <- docx_file } redoc <- read_docx(x) xml_child(docx_body_xml(redoc)) } get_pptx_xml <- function(x) { if (inherits(x, "flextable")) { pptx_file <- tempfile(fileext = ".pptx") doc <- read_pptx() doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") doc <- ph_with(doc, x, location = ph_location_type(type = "body")) print(doc, target = pptx_file) x <- pptx_file } redoc <- read_pptx(x) slide <- redoc$slide$get_slide(redoc$cursor) xml_child(slide$get()) } get_html_xml <- function(x) { if (inherits(x, "flextable")) { html_file <- tempfile(fileext = ".html") save_as_html(tab, path = html_file) x <- html_file } doc <- read_html(x) xml_child(doc, "body") } get_pdf_text <- function(x, extract_fun) { stopifnot(grepl("\\.pdf$", x)) doc <- extract_fun(x) txtfile <- tempfile() cat(paste0(doc, collapse = "\n"), file = txtfile) readLines(txtfile) } render_rmd <- function(file, rmd_format) { unlink(file, force = TRUE) sucess <- FALSE tryCatch( { render(rmd_file, output_format = rmd_format, output_file = pdf_file, envir = new.env(), quiet = TRUE ) sucess <- TRUE }, warning = function(e) { }, error = function(e) { } ) sucess } # Getting snapshots in the _snaps folder for local testing if conditions are met do_manual_msoffice_snapshot_testing <- FALSE copy_back_new_snapshots <- FALSE # if snapshots are updated can be rewritten back # Utility function to manually test local snapshots ---------------------------- skip_if_not_local_testing <- function(min_pandoc_version = "2", check_html = FALSE) { skip_on_cran() # When doing manual testing, it should be always skipped on CRAN skip_on_ci() # msoffice testing can not be done on ci skip_if_not(do_manual_msoffice_snapshot_testing) local_edition(3, .env = parent.frame()) # Set the local_edition at 3 skip_if_not_installed("doconv") skip_if_not(doconv::msoffice_available()) if (!is.null(min_pandoc_version)) { # Can be turned off with NULL skip_if_not(rmarkdown::pandoc_version() >= numeric_version(min_pandoc_version)) } if (isTRUE(check_html)) { skip_if_not_installed("webshot2") } invisible(TRUE) } handle_manual_snapshots <- function(snapshot_folder, snapshot_name) { skip_if_not_installed("withr") skip_if_not(do_manual_msoffice_snapshot_testing) snapshot_name <- paste0(snapshot_name, ".png") # Folder where the snapshots are stored main_inst_folder <- system.file("snapshots_for_manual_tests", package = "flextable", mustWork = TRUE) snapshot_file <- file.path(main_inst_folder, snapshot_folder, snapshot_name) if (!file.exists(snapshot_file)) { stop("Following snapshot file not found in {flextable}:", snapshot_file) } # Construct the path to the _snaps folder path_to_snaps <- file.path("_snaps", snapshot_folder) if (!dir.exists("_snaps")) { dir.create("_snaps") } if (!dir.exists(path_to_snaps)) { dir.create(path_to_snaps) } # Main copy file.copy(snapshot_file, path_to_snaps, overwrite = TRUE) # Copying back and cleaning test folder withr::defer( { snap_file <- file.path(path_to_snaps, snapshot_name) if (copy_back_new_snapshots) { file.copy(snap_file, dirname(snapshot_file), overwrite = TRUE) } if (file.exists(snap_file)) { file.remove(snap_file) } }, envir = parent.frame() ) } defer_cleaning_snapshot_directory <- function(snap_folder_test_file) { skip_if_not_installed("withr") skip_if_not(do_manual_msoffice_snapshot_testing) withr::defer({ last_folder <- file.path("_snaps", snap_folder_test_file) files_not_removed_for_error <- list.files(last_folder) if (length(files_not_removed_for_error)) { lapply(files_not_removed_for_error, file.remove) } if (dir.exists("_snaps")) { unlink("_snaps", recursive = TRUE) } }) } flextable/tests/testthat/test-proc-freq.R0000644000176200001440000000452414615445174020240 0ustar liggesusersp <- structure(list( lengths = c(9894L, 104L, 1L, 1L), values = c("No", "Yes", NA, NA) ), class = "rle") o <- structure(list( lengths = c(9641L, 252L, 1L, 23L, 81L, 1L, 1L), values = c("No", "Yes", NA, "No", "Yes", "No", NA) ), class = "rle") dat <- data.frame( p = inverse.rle(p), o = inverse.rle(o) ) full_dump_txt <- c( "o", "", "p", "p", "p", "p", "o", "", "No", "Yes", "Missing", "Total", "No", "Count", "9,641 (96.4%)", "", "23 (0.2%)", "", "1 (0.0%)", "", "9,665 (96.7%)", "", "No", "Mar. pct", " (1)", "", "97.4% ; 99.8%", "", "22.1% ; 0.2%", "", "50.0% ; 0.0%", "", "", "Yes", "Count", "252 (2.5%)", "", "81 (0.8%)", "", "", "", "333 (3.3%)", "", "Yes", "Mar. pct", "", "2.5% ; 75.7%", "", "77.9% ; 24.3%", "", "", "", "", "Missing", "Count", "1 (0.0%)", "", "", "", "1 (0.0%)", "", "2 (0.0%)", "", "Missing", "Mar. pct", "", "0.0% ; 50.0%", "", "", "", "50.0% ; 50.0%", "", "", "Total", "Count", "9,894 (98.9%)", "", "104 (1.0%)", "", "2 (0.0%)", "", "10,000 (100.0%)", "", " (1)", " Columns and rows percentages", "", "", "", "", "" ) single_dump_txt <- c( "o", "Count", "Percent", "No", "9,665", "96.7%", "Yes", "333", "3.3%", "Missing", "2", "0.0%", "Total", "10,000", "100.0%" ) count_only_dump_txt <- c( "o", "p", "p", "p", "p", "o", "No", "Yes", "Missing", "Total", "No", "9,641", "", "23", "", "1", "", "9,665", "", "Yes", "252", "", "81", "", "", "", "333", "", "Missing", "1", "", "", "", "1", "", "2", "", "Total", "9,894", "", "104", "", "2", "", "10,000", "" ) test_that("proc_freq executes without errors", { dummy_df <- data.frame( values = rep(letters[1:3], each = 2), groups = rep(letters[1:3], each = 2), stringsAsFactors = FALSE ) ft <- proc_freq(dummy_df, "values", "groups") expect_equal(class(ft), "flextable", ignore_attr = TRUE) }) test_that("proc_freq content", { ft <- proc_freq(dat, row = "o", col = "p") expect_equal(information_data_chunk(ft)$txt, full_dump_txt) ft <- proc_freq(dat, row = "o") expect_equal(information_data_chunk(ft)$txt, single_dump_txt) ft <- proc_freq(dat, row = "o", col = "p", include.table_percent = FALSE, include.row_percent = FALSE, include.column_percent = FALSE ) expect_equal(information_data_chunk(ft)$txt, count_only_dump_txt) expect_error(proc_freq(dat)) }) flextable/tests/testthat/test-pptx-tables.R0000644000176200001440000000304014615445172020573 0ustar liggesuserstest_that("row height is valid", { ft <- flextable(head(iris)) pptx_file <- "test.pptx" doc <- read_pptx() doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") doc <- ph_with(doc, value = ft, location = ph_location_type(type = "body")) doc <- print(doc, target = pptx_file) main_folder <- file.path(getwd(), "pptx_folder") unzip(pptx_file, exdir = main_folder) slide_file <- file.path(main_folder, "/ppt/slides/slide1.xml") doc <- read_xml(slide_file) nodes <- xml_find_all(doc, "//p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr") h_values <- sapply(nodes, xml_attr, attr = "h") h_values <- as.integer(h_values) expect_true(all(is.finite(h_values))) expect_true(all(h_values > 0)) unlink(main_folder, recursive = TRUE, force = TRUE) unlink(pptx_file, force = TRUE) }) test_that("location is correct", { ft <- flextable(head(iris)) pptx_file <- tempfile(fileext = ".pptx") doc <- read_pptx() doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") doc <- ph_with(doc, value = ft, location = ph_location(left = 0, top = 0)) doc <- print(doc, target = pptx_file) main_folder <- file.path(getwd(), "pptx_folder") unpack_folder(file = pptx_file, folder = main_folder) slide_file <- file.path(main_folder, "/ppt/slides/slide1.xml") doc <- read_xml(slide_file) node <- xml_find_first(doc, "//p:graphicFrame/p:xfrm/a:off") expect_equal(xml_attr(node, "x"), "0") expect_equal(xml_attr(node, "y"), "0") unlink(main_folder, recursive = TRUE, force = TRUE) }) flextable/tests/testthat/test-footers.R0000644000176200001440000000301714615445137020016 0ustar liggesuserstest_that("add_footer", { data_ref <- structure( list( Sepal.Length = c("Sepal", "s", "(cm)"), Sepal.Width = c("Sepal", "", "(cm)"), Petal.Length = c("Petal", "", "(cm)"), Petal.Width = c("Petal", "", "(cm)"), Species = c("Species", "", "(cm)") ), .Names = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c(NA, -3L), class = "data.frame" ) ft <- flextable(iris[1:6, ]) ft <- add_footer( ft, Sepal.Length = "Sepal", Sepal.Width = "Sepal", Petal.Length = "Petal", Petal.Width = "Petal", Species = "Species" ) ft <- add_footer(ft, Sepal.Length = "s", top = FALSE) ft <- add_footer( ft, Sepal.Length = "(cm)", Sepal.Width = "(cm)", Petal.Length = "(cm)", Petal.Width = "(cm)", Species = "(cm)", top = FALSE ) has_ <- flextable:::fortify_content( ft$footer$content, default_chunk_fmt = ft$footer$styles$text )$txt expect_equal(has_, as.character(unlist(data_ref))) ft <- flextable(iris[1:6, ]) ft <- add_footer_row( ft, values = c("Sepal", "Petal", "Species"), colwidths = c(2, 2, 1) ) ft <- add_footer_lines(ft, "s", top = FALSE) ft <- add_footer_row(ft, values = "(cm)", colwidths = 5, top = FALSE) has_ <- flextable:::fortify_content( ft$footer$content, default_chunk_fmt = ft$footer$styles$text )$txt ref <- c( "Sepal", "s", "(cm)", "Sepal", "s", "(cm)", "Petal", "s", "(cm)", "Petal", "s", "(cm)", "Species", "s", "(cm)" ) expect_equal(has_, ref) }) flextable/tests/testthat/test-link.R0000644000176200001440000000303514615445130017263 0ustar liggesusersdata <- data.frame( code = c("X01", "X02"), name = c("X Number 1", "X Number 2"), stringsAsFactors = FALSE ) url_base <- "https://example.com?/path&project=%s" ft <- flextable(data) ft <- mk_par( x = ft, j = ~code, value = as_paragraph( hyperlink_text(code, url = sprintf(url_base, code)) ) ) test_that("URL are preserved in docx", { outfile <- tempfile(fileext = ".docx") save_as_docx(ft, path = outfile) doc <- read_docx(path = outfile) body <- docx_body_xml(doc) rid <- xml_attr(xml_find_all(body, "//w:hyperlink"), "id") rels <- doc$doc_obj$rel_df() urls <- rels[rels$id %in% rid, "target"] expect_equal(urls, sprintf(url_base, data$code), ignore_attr = TRUE) }) test_that("URL are preserved in pptx", { outfile <- tempfile(fileext = ".pptx") save_as_pptx(ft, path = outfile) doc <- read_pptx(path = outfile) xml_slide <- doc$slide$get_slide(1)$get() rid <- xml_attr(xml_find_all(xml_slide, "//a:hlinkClick"), "id") rels <- doc$slide$get_slide(1)$rel_df() urls <- rels[rels$id %in% rid, "target"] expect_equal(urls, sprintf(url_base, data$code), ignore_attr = TRUE) }) test_that("URL are preserved in html", { str_ <- flextable:::gen_raw_html(ft) str_ <- gsub("", "", str_) str_ <- gsub("", "", str_) str_ <- gsub("