How to correct the wrongly predetermined test methods in add_p() function in package gtsummary?

Dear fellows, I have been hampered by a wrong test method problem using package gtsummary and I could not get rid of it after resorting to ChatGPT sadly. The question could be possibly stated as follows:

tbl <- tbl_summary(
include = everything()
, by = IfExacerbate
, statistic = list(
all_continuous() ~ "{mean} ({sd})",
all_categorical() ~ "{n} / {N} ({p}%)"
)
, digits = all_continuous() ~ 2
) %>%
add_n() %>%
add_p(
test = list(
all_continuous() ~ "wilcox.test"
, all_categorical() ~ "fisher.test"
)
) %>%
modify_header(label = "Variable") %>%
bold_labels() %>%
as_flex_table

I tried to generate a table containing two-group (grouping variable: IfExacerbate) comparison statistics with the snippets showed above. However, one of my numeric variables (the specific name of which is var_name,, for example, with its numeric type confirmed already) containing 9 natural numbers from 0 to 8 underwent fisher's exact test rather than wilcoxon test surprisingly. I tried with:

add_p(
test = list(
var_name ~ "wilcox.test"
, all_continuous() ~ "wilcox.test"
, all_categorical() ~ "fisher.test"
, var_name ~ "wilcox.test"
)
) %>%

and it did not work at all. Tired of the tedious and inconsistent answers from ChatGPT, I have no other ways but to seek for help here. Any suggestions will be largely be appreciated! Thanks!

The tbl_summary() function makes its best guess to the summary type that fits the data. But it's not always what you want. Thisis documented in the function's help file: Summary table — tbl_summary • gtsummary

Use the type argument to change the default summary type. In your case, you want to change from categorical to continuous.