flex_print | R Documentation |
A wrapper function for flextable::flextable()
with some of my preferred
formatting for simple tables.
flex_print(
x,
font_name = "Arial",
font_size = 11,
align = NULL,
align_j = NULL,
auto_fit = TRUE,
width = NULL,
width_j = NULL,
width_unit = "in",
col_nms = NULL,
col_lbls = NULL,
title = NULL,
subtitle = NULL,
footer = NULL,
title_size = 16,
subtitle_size = 11,
footer_size = 11,
na_dflt = "NA",
nan_dflt = "NaN"
)
x |
dataset |
font_name |
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). For "all" table parts. |
font_size |
integer value (points). For "all" table parts. |
align |
Column alignment: a character vector consisting of 'l' (left), 'c' (center), 'r' (right), and/or 'j' (justify). By default or if align = NULL, numeric columns are right-aligned, and other columns are left-aligned. If length(align) == 1L, the string will be expanded to a vector of individual letters, e.g. 'clc' becomes c('c', 'l', 'c'). |
align_j |
Column selection for |
auto_fit |
Logical (Default is FALSE). See |
width |
width in inches as a character vector. |
width_j |
columns selection for width. |
width_unit |
unit for width, one of "in", "cm", "mm". |
col_nms |
Names of columns to be labelled. |
col_lbls |
Labels to apply to columns different from column names. |
title |
The text for the title. |
subtitle |
The text for the subtitle which will be displayed below the title. |
footer |
The text for the footer which will be displayed below the body of the table. |
title_size |
Font size for the title. Default is 16. |
subtitle_size |
Font size for the subtitle. Default is 11. |
footer_size |
Font size for the footer Default is 11. |
na_dflt , nan_dflt |
string to be used for NA and NaN values. |
A flextable
flex_print(x = head(iris))
flex_print(x = head(iris),
font_name = "Lato",
title = "Edgar Anderson's Iris Data",
title_size = 16,
subtitle = "Just the head")
flex_print(x = head(iris),
font_name = "Lato",
title = "Edgar Anderson's Iris Data",
title_size = 16)
flex_print(x = head(iris),
font_name = "Times New Roman",
title = "Edgar Anderson's Iris Data",
title_size = 16,
footer = "The data were collected by Anderson, Edgar (1935)...")
flex_print(x = head(iris),
align = c("c"),
col_lbls = c("Sepal Length",
"Sepal Width",
"Petal Length",
"Petal Width",
"Species"))
flex_print(x = head(iris),
align = c("c"),
col_nms = names(head(iris)),
col_lbls = c("Sepal\nLength",
"Sepal\nWidth",
"Petal Length",
"Petal Width",
"Species"),
font_size = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.