ReporteRs
has functions to manage objects representing:
With ReporteRs, some options can be used to reduce usage of some parameters. These are then used as default values for textProperties
objects:
getOption('ReporteRs-fontsize')
## [1] 11
getOption('ReporteRs-default-font')
## [1] "Times New Roman"
Create a textProperties
object that describes text formatting properties. It let you specify font name color, size, weight, etc.
textProperties
objects can be used with function pot
and when manipulating FlexTable
objects.
my_text
My tailor is rich
MyFTable[ 1, 1, to = "header"] = my_text
MyFTable
My tailor is rich |
mpg |
cyl |
disp |
hp |
drat |
wt |
qsec |
vs |
am |
gear |
carb |
Mazda RX4 |
21.0 |
6 |
160 |
110 |
3.90 |
2.620 |
16.46 |
0 |
1 |
4 |
4 |
Mazda RX4 Wag |
21.0 |
6 |
160 |
110 |
3.90 |
2.875 |
17.02 |
0 |
1 |
4 |
4 |
Datsun 710 |
22.8 |
4 |
108 |
93 |
3.85 |
2.320 |
18.61 |
1 |
1 |
4 |
1 |
Hornet 4 Drive |
21.4 |
6 |
258 |
110 |
3.08 |
3.215 |
19.44 |
1 |
0 |
3 |
1 |
Hornet Sportabout |
18.7 |
8 |
360 |
175 |
3.15 |
3.440 |
17.02 |
0 |
0 |
3 |
2 |
Create a parProperties
object that describes paragraph formatting properties. It let you specify text alignment, paddings, the kind of numbering if paragraphs are a list, etc.
A parProperties
object is used by several functions, ie. addPlot, addFlexTable, addParagraph.
Create a cellProperties
object that describes cell formatting properties. It let you specify cell borders, background color, etc.
A cellProperties object is used with FlexTable
objects.
Create a borderProperties
object that describes border formatting properties.
A borderProperties object is used with FlexTable
objects and with parProperties
objects.
MyFTable[ 1, to = "header", side = "bottom"] = borderProperties(color="orange", style="solid", width=4)
MyFTable
Sepal.Length |
Sepal.Width |
Petal.Length |
Petal.Width |
Species |
5.1 |
3.5 |
1.4 |
0.2 |
setosa |
4.9 |
3.0 |
1.4 |
0.2 |
setosa |
4.7 |
3.2 |
1.3 |
0.2 |
setosa |
4.6 |
3.1 |
1.5 |
0.2 |
setosa |
5.0 |
3.6 |
1.4 |
0.2 |
setosa |
To get modified copies of textProperties, parProperties, and cellProperties objects, use the function chprop
.
It makes the code less verbose and makes easier to specify formatting properties on FlexTable.
MyFTable[] <- base_par_prop
MyFTable[] <- base_cell_prop
MyFTable[] <- base_text_prop
MyFTable
Sepal.Length |
Sepal.Width |
Petal.Length |
Petal.Width |
Species |
5.1 |
3.5 |
1.4 |
0.2 |
setosa |
4.9 |
3.0 |
1.4 |
0.2 |
setosa |
4.7 |
3.2 |
1.3 |
0.2 |
setosa |
4.6 |
3.1 |
1.5 |
0.2 |
setosa |
5.0 |
3.6 |
1.4 |
0.2 |
setosa |
The following functions are shortcuts for textProperties
function calls:
The following functions are shortcuts for parProperties
function calls:
MyFTable
Sepal.Length |
Sepal.Width |
Petal.Length |
Petal.Width |
Species |
5.1 |
3.5 |
1.4 |
0.2 |
setosa |
4.9 |
3.0 |
1.4 |
0.2 |
setosa |
4.7 |
3.2 |
1.3 |
0.2 |
setosa |
4.6 |
3.1 |
1.5 |
0.2 |
setosa |
5.0 |
3.6 |
1.4 |
0.2 |
setosa |
The following functions are shortcuts for borderProperties
function calls: borderDashed, borderDotted, borderSolid and borderNone.
The following functions are shortcuts for cellProperties
function calls: cellBorderNone, cellBorderBottom, cellBorderTop and cellBorderTB.