# Load in pipe
library(magrittr)
library(dplyr)
header_string <- "Sepal {Length | Width} | Petal {Length | Width} | Species"
iris2 <- iris %>%
mutate_all(as.character)
iris2 %>% add_column_headers(header_string)
# Example with counts
mtcars2 <- mtcars %>%
mutate_all(as.character)
t <- tplyr_table(mtcars2, vs, cols = am) %>%
add_layer(
group_count(cyl)
)
b_t <- build(t) %>%
mutate_all(as.character)
count_string <- paste0(" | V N=**0** {auto N=**0_0** | man N=**0_1**} |",
" S N=**1** {auto N=**1_0** | man N=**1_1**} | | ")
add_column_headers(b_t, count_string, header_n(t))
Run the code above in your browser using DataLab