Pb with tbl_summary "{mean} ({sd})"

Hi everyone, when I write this line for my table 1 :

tbl_summary(by = state, missing="no", type = list(biomass ~ "continuous"),
statistic = list(all_continuous() ~ "{mean} (sd)"))

I have an error message : Erreur : Problem with mutate() column df_stats. :information_source: df_stats = pmap(...). x nms %in% c("i", "x", "") ne sont pas TRUE. (sorry it's in french).

When I delete the {} around sd, I have my table 1 back but only with the mean and not the sd (which is written like this (sd) next to the calculated mean).

I tried everything but it seems that I don't find a solution. I think I have the last version of RStudio (2021.09.0+351) for mac and I updated all my packages.

Thanks for your help

Does anyone have this problem ?

This seems to work :

library(gtsummary)

tbl_summary(data = iris ,
            by=Species,missing="no",
            type=list(Sepal.Length~"continuous"),
            statistic = list(all_continuous() ~ "{mean} ({sd})"))

Therefore not sure what problem you are having. Does this work for you ?

1 Like

Thanks for the answer. No, it doesn't work for me.

Does the code that I wrote , exactly as it is with no changes, work for you ?

It is rather difficult to work from a screenshot.

What we need is a reproducible example (reprex)

I just tried now with your code and I have the same error message. I downloaded the last version of RStudio but the problem still persists. 2021.09.1+372.

And sorry for the screenshot, I will post the code directly the next times, here it was to show the error message :slight_smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.