# Create a sample data frame
df = data.frame(
Category = c("A", "B", "C", "D", "E"),
Value = c(10, 20, 30, 40, 50)
)
# Display the table with a title and header
table_summary(df, title = "Sample Table", header = TRUE)
# Split the table after the second row and center it
table_summary(df, l = 2, center_table = TRUE)
# Use styling and alignment
table_summary(
df, header = TRUE,
style = list(
left_col = "blue_bold",
right_col = "red",
title = "green",
border_text = "yellow"
),
align = c("center", "right")
)
# Use custom styling with lambda functions
table_summary(
df, header = TRUE,
style = list(
left_col = \(ctx) cli::col_red(ctx), # ctx$value is another option
right_col = \(ctx) cli::col_blue(ctx)
),
align = list(left_col = "left", right_col = "right")
)
Run the code above in your browser using DataLab