as_gt.crosstable {crosstable} | R Documentation |
Converts a crosstable
object into a formatted gt
table.
Description
Converts a crosstable
object into a formatted gt
table.
Method to convert an object to a gt
table
Default method to convert an object to a gt
table
Usage
## S3 method for class 'crosstable'
as_gt(
x,
show_test_name = TRUE,
by_header = NULL,
keep_id = FALSE,
generic_labels = list(id = ".id", variable = "variable", value = "value", total =
"Total", label = "label", test = "test", effect = "effect"),
...
)
as_gt(x, ...)
## Default S3 method:
as_gt(x, ...)
Arguments
x |
object to be converted |
show_test_name |
in the |
by_header |
a string to override the |
keep_id |
whether to keep the |
generic_labels |
names of the crosstable default columns |
... |
arguments for custom methods |
Value
a formatted gt
table
Methods (by class)
-
as_gt(crosstable)
: For crosstables -
as_gt(default)
: default function
Author(s)
Dan Chaltiel
See Also
Examples
xx = mtcars2 %>% dplyr::select(2:10)
crosstable(xx) %>% as_gt
crosstable(xx, by=am) %>% as_gt
crosstable(xx, by=cyl, test=TRUE, total=TRUE) %>%
as_gt(keep_id=TRUE, show_test_name=FALSE, by_header="Cylinders")
[Package crosstable version 0.7.0 Index]