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"))
x | data.frame. |
---|---|
olay | officer layout created using |
id | of placeholder in |
method | 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)#> a flextable object. #> col_keys: `Sepal.Length`, `Species` #> header has 1 row(s) #> body has 10 row(s) #> original dataset sample: #> Sepal.Length Species #> 141 6.7 virginica #> 142 6.9 virginica #> 143 5.8 virginica #> 144 6.8 virginica #> 145 6.7 virginicaphl_adjust_table(x, offLayout, 2)#> a flextable object. #> col_keys: `Sepal.Length`, `Species` #> header has 1 row(s) #> body has 10 row(s) #> original dataset sample: #> Sepal.Length Species #> 141 6.7 virginica #> 142 6.9 virginica #> 143 5.8 virginica #> 144 6.8 virginica #> 145 6.7 virginica