Create flextable from data.frame and try to fit the result into layout's placeholder.
phl_adjust_table(x, olay, id, method = c("all", "height"))data.frame.
officer layout created using phl_layout.
of placeholder in olay.
if 'all' (default) fits both the width and height. If 'height' fits only height.
A flextable object, which should
fit into the layout's placeholder.
The result should be ready to pass it
into phl_with_flextable.
lay <- lay_new(matrix(1:4,nc=2),widths=c(3,2),heights=c(2,1))
lay2 <- lay_new(matrix(1:3))
lay3 <- lay_bind_col(lay,lay2, widths=c(3,1))
offLayout <- phl_layout(lay3)
x <- tail(iris, 10)[,c(1,5)]
phl_adjust_table(x, offLayout, 1)
Sepal.Length
Species
6.7
virginica
6.9
virginica
5.8
virginica
6.8
virginica
6.7
virginica
6.7
virginica
6.3
virginica
6.5
virginica
6.2
virginica
5.9
virginica
phl_adjust_table(x, offLayout, 2)
Sepal.Length
Species
6.7
virginica
6.9
virginica
5.8
virginica
6.8
virginica
6.7
virginica
6.7
virginica
6.3
virginica
6.5
virginica
6.2
virginica
5.9
virginica