How can I use 2 times digits argument in tbl_summary()

I want to use 2 times the digits= argument in tbl_summary but I can't.
Once it would be like this to specify the number of decimal digits

digits = list(all_categorical() ~ c(0,1))

and the second one to indicate that there is no space as a separator for big numbers

digits = ~label_style_number(big.mark = "")

But it doesn't work in the same code

df %>% %>%
  mutate_all(as.factor) %>%
  tbl_summary(statistic = list(all_categorical() ~ "{n} ({p})"),
              digits = list(all_categorical() ~ c(0,1)),
              digits = list(a ~ label_style_number(big.mark = "")))

Error in tbl_summary(., statistic = list(all_categorical() ~ “{n} ({p}”), : 
  formal argument “digits” matches multiple specified arguments.

also tried this

df %>%
  mutate_all(as.factor) %>%
  tbl_summary(
    by= a,
    missing = "always",
    statistic = list(all_categorical() ~ "{n} ({p})"),
    sort = all_categorical(FALSE) ~ "frequency",
    digits = list(all_categorical() ~ c(0, 1),
                  b ~ label_style_number(big.mark = "")))

but it returns a 0 in the decimals for all values

How can I have both things?

This is the minimal reproducible example I use:

df<-
  tibble(a= sample(c('red', 'blue', 'pink'),
                 size= 10000,
                 replace= T),
         b= sample(c('car', 'bike', 'boat'),
                   size= 10000,
                   replace= T))
df %>% 
  mutate_all(as.factor) %>%
  tbl_summary(
    statistic = list(all_categorical() ~ "{n} ({p})"),
    digits = list(
      all_categorical() ~ label_style_number(digits = c(0,1)),
      a ~ label_style_number(big.mark = "")
      )
    )
1 Like

Doesn't work, it returns a 0 in the decimals for all values

it returns a 0 in because it's rounding 0.3... to 0 set higher values

df %>% 
  mutate_all(as.factor) %>%
  tbl_summary(
    statistic = list(all_categorical() ~ "{n} ({p})"),
    digits = list(
      all_categorical() ~ label_style_number(digits = c(3,0)),
      a ~ label_style_number(big.mark = "", digits = c(3,0))
    )
  )

Hi, but I need the values in %, like 3 not 0.3.

Then use label_style_percent() in stead of label_style_number()