I am trying to store a bunch of t-tables in a gt group for quick display. say I have a list of accounts like:
accounts <- c(
"Cash",
"Accounts Receivable(A/R)",
"Interest Receivable",
"AFDA",
"Inventory",
"Supplies On Hand (SOH)")
I then write a for loop to make a table for every account: `
TaccGt <- gt_group()
for (i in accounts) {
GTtemp <- gt(data.frame(t(l1))) %>%
tab_header(i)%>%
cols_width(everything()~px(75)) %>%
tab_options(column_labels.hidden = TRUE,
table.border.top.style = "hidden",
table.border.bottom.style = "hidden",
data_row.padding = px(100)
) %>%
tab_style(
style = cell_borders(
sides = c("right","top"),
color = "black",
weight = px(2),
),
locations=cells_body()
)%>%
tab_style(
style = cell_borders(
sides = c("right"),
color = "white",
weight = px(2),
),
locations=cells_body(2,1)
)
TaccGt[i] <- grp_add(GTtemp)
}
When I run the code in the loop I get exactly what I want, a nice little t-table that I will then print with the as_latex() function to add to a pdf. But when I put them into the group I have it stripped down to a tibble that doesn't have any of the features from the above code.
What gives?? I haven't found many people giving examples of gt_group in a loop.
Thanks!