Learn R Programming

rrtable (version 0.1.0)

df2flextable: Convert data.frame to flextable

Description

Convert data.frame to flextable

Usage

df2flextable(df, vanilla = FALSE, fontname = NULL, fontsize = 10,
  add.rownames = FALSE, even_header = "transparent",
  odd_header = "#5B7778", even_body = "#EFEFEF", odd_body = "transparent",
  vlines = TRUE, colorheader = FALSE, digits = 2,
  align_header = "center", align_body = "right", NA2space = FALSE,
  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

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'.

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

Run this code
# NOT RUN {
require(flextable)
require(officer)
df2flextable(head(iris),vanilla=TRUE,colorheader=TRUE)
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))
# }

Run the code above in your browser using DataLab