You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add footnotes throughout all levels of a variable and across a couple columns. Then I want to convert it to a flextable. I get an error at the as_flex_table stage.
I think it's because during the creation of the flextable, (something that creates flextable_calls) it tries to create footnotes that reference at all permutations of i and j. However, flextable uses the pairwise combination of i and j:
flextable::footnotes
Symbols are added to the cells designated by the selection i and j. If you use i = c(1,3) and j = c(2,5), then you will add the symbols (or the repeated symbol) to cells [1,2] and [3,5].
In addition to the example error below, I'm noticing that some other tables will only have flextable footnotes in alternating rows because of the way i and j are expanded.
library(dplyr)
library(gtsummary)
trial %>%
tbl_summary(by=trt,
include= c(age,
stage,
grade)) %>%
modify_table_styling(columns= c(stat_1, stat_2),
rows= (variable%in%"grade") & (row_type=="level"),
footnote="Cell-level foonotes here.") %>%
as_flex_table()
#> Error in data.frame(i = i, j = j): arguments imply differing number of rows: 3, 2
Thank you for the report and the reprex! I am surprised this hasn't been reported long ago...these lines of code haven't been touched in years. Much appreciated! This should be addressed in #2063
I want to add footnotes throughout all levels of a variable and across a couple columns. Then I want to convert it to a flextable. I get an error at the
as_flex_table
stage.I think it's because during the creation of the flextable, (something that creates
flextable_calls
) it tries to create footnotes that reference at all permutations ofi
andj
. However,flextable
uses the pairwise combination ofi
andj
:flextable::footnotes
In addition to the example error below, I'm noticing that some other tables will only have flextable footnotes in alternating rows because of the way
i
andj
are expanded.Created on 2024-11-08 with reprex v2.1.1
When debugging
as_flex_table
The text was updated successfully, but these errors were encountered: