as_flextable_methods {ftExtra} | R Documentation |
Method to transform objects into flextables
Description
This is a convenient function to let users create flextable bindings from any objects. Users should consult documentation of corresponding method to understand the details and see what arguments can be used.
Usage
## S3 method for class 'grouped_df'
as_flextable(
x,
groups_to = c("titles", "merged", "asis"),
groups_pos = c("left", "asis"),
groups_arrange = NULL,
...
)
## S3 method for class 'data.frame'
as_flextable(x, col_keys = names(x), ...)
Arguments
x |
object to be transformed as flextable |
groups_to |
One of |
groups_pos |
When |
groups_arrange |
|
... |
arguments for custom methods |
col_keys |
columns names/keys to display. If some column names are not in the dataset, they will be added as blank columns by default. |
See Also
Other as_flextable methods:
as_flextable.data.frame()
,
as_flextable.gam()
,
as_flextable.glm()
,
as_flextable.grouped_data()
,
as_flextable.htest()
,
as_flextable.kmeans()
,
as_flextable.lm()
,
as_flextable.merMod()
,
as_flextable.pam()
,
as_flextable.summarizor()
,
as_flextable.table()
,
as_flextable.tabular()
,
as_flextable.tabulator()
,
as_flextable.xtable()
Examples
# For grouped_df
grouped_df <- iris %>%
dplyr::group_by(Species) %>%
dplyr::slice(1, 2)
as_flextable(grouped_df, groups_to = "titles")
as_flextable(grouped_df, groups_to = "titles", hide_grouplabel = TRUE)
as_flextable(grouped_df, groups_to = "merged")
as_flextable(grouped_df, groups_to = "asis")
# For data.frame
iris %>%
head() %>%
as_flextable()