Skip to content
Snippets Groups Projects
Commit f67fc0d5 authored by Ben Anderson's avatar Ben Anderson
Browse files

added functions.R (makeFlextable)

parent 3aa1ef62
No related branches found
No related tags found
No related merge requests found
# useful functions
# use source(here::here("R", "functions.R")) to load
require(flextable) # use require so it fails if not present & can't install
makeFlexTable <- function(df, cap = "caption"){
# makes a pretty flextable - see https://cran.r-project.org/web/packages/flextable/index.html
ft <- flextable::flextable(df)
ft <- flextable::colformat_double(ft, digits = 1)
ft <- flextable::fontsize(ft, size = 9)
ft <- flextable::fontsize(ft, size = 10, part = "header")
ft <- flextable::set_caption(ft, caption = cap)
return(flextable::autofit(ft))
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment