color.flextable: create colored flextable from input dataframe and write to ms...

View source: R/color.flextable.R

color.flextableR Documentation

create colored flextable from input dataframe and write to ms word

Description

create colored flextable from input dataframe and write to ms word

Usage

color.flextable(
  x,
  colFields = NA,
  colRows = NA,
  cols = colorRamps::blue2red(40)[10:40],
  breaks = NA,
  breaksType = c("quantile", "equal"),
  outDocx = NA,
  preview = T,
  digits = 0,
  return = T,
  by.row = F,
  by.col = F
)

Arguments

x

input data.frame

colFields

numeric fields to color

colRows

choose a subset of rows (numbers or row ids) to color

cols

sequence of colors as from colorRamps::blue2red(40)

breaks

(optional) sequence of break values to use in slicing x into colors

breaksType

(optional) if breaks = NA, then use either quantile or equal interval breaks

outDocx

(optional) provide location to write flex table as word document

preview

should a temporary word document with flex table be opened

digits

how many digits should be retained (round) for numeric values

return

T/F should a flextable be returned?

Details

This program is free software but it is provided WITHOUT WARRANTY and with ABSOLUTELY NO GUARANTEE of fitness or functionality for any purpose; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.


Revision History

1.0 7/7/2020 function created
1.1 date and revisions..
1.2 add row / column options

Value

NULL or a flex table if return == T

Author(s)

Jacob Strunk <Jacob.strunk@usda.gov>

See Also

print.flextable
flextable
quantile
save_as_docx

Examples

 <Delete and Replace>


jstrunk001/RSForInvt documentation built on April 18, 2022, 11:03 p.m.