df2flextable: Convert data.frame to flextable

View source: R/df2flextable.R

df2flextableR Documentation

Convert data.frame to flextable

Description

Convert data.frame to flextable

Usage

df2flextable(
  df,
  vanilla = FALSE,
  fontname = NULL,
  fontsize = 12,
  add.rownames = FALSE,
  even_header = "transparent",
  odd_header = "#5B7778",
  even_body = "#EFEFEF",
  odd_body = "transparent",
  vlines = TRUE,
  colorheader = FALSE,
  digits = 2,
  digitp = 3,
  align_header = "center",
  align_body = "right",
  align_rownames = "left",
  NA2space = TRUE,
  pcol = NULL,
  ...
)

Arguments

df

A data.frame

vanilla

A Logical

fontname

Font name

fontsize

font size

add.rownames

logical. Whether or not include rownames

even_header

background color of even_header

odd_header

background color of even_header

even_body

background color of even_body

odd_body

background color of even_body

vlines

Logical. Whether or not draw vertical lines

colorheader

Logical. Whether or not use color in header

digits

integer indicating the number of decimal places

digitp

integer indicating the number of decimal places of p values

align_header

alignment of header. Expected value is one of 'left', 'right', 'center', 'justify'.

align_body

alignment of body. Expected value is one of 'left', 'right', 'center', 'justify'.

align_rownames

alignment of rownames. Expected value is one of 'left', 'right', 'center', 'justify'.

NA2space

A logical. If true, convert NA value to space

pcol

An integer indicating p value. If specified, convert value less than 0.01 to "< 0.001" in given column.

...

further arguments to be passed to flextable

Examples

require(flextable)
require(officer)
df2flextable(head(iris),vanilla=TRUE,colorheader=TRUE)
## Not run: 
df2flextable(head(iris),vanilla=TRUE,digits=c(1,2,3,4))
df2flextable(head(iris),vanilla=FALSE)
df2flextable(head(iris),vanilla=FALSE,vlines=FALSE,fontsize=14)
df2flextable(head(mtcars/2000),digits=3,pcol=8,digitp=4,add.rownames=TRUE)

## End(Not run)

cardiomoon/rrtable documentation built on March 14, 2023, 10:39 p.m.