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've noticed that using the by argument in tbl_summary won't work if the column I am summarizing by is named "variable". I'm assuming this is some kind of parsing issue. Things work fine when I change the variable name to group, see reprex below. I haven't taken a close look as to why this might be occurring. Thought an issue may be relevant as the default output of data.table's melt function (from wide to long) includes a column entitled variable.
library(gtsummary)
df<-data.frame(group= c(rep("A", 5), rep("B", 5)), value=1:10)
tbl1<-df|>
tbl_summary(
by="group"
)
df<-data.frame(variable= c(rep("A", 5), rep("B", 5)), value=1:10)
tbl2<-df|>
tbl_summary(
by="variable"
)
#> Error in `mutate()`:#> ! Problem while computing `df_stats = pmap(...)`.#> Caused by error in `set_names()`:#> ! The size of `nm` (2) must be compatible with the size of `x` (1).
Thank you so much for the reprex and the bug report. I used the column name variable SO much within the internals....it's surely an issue with one too many columns running around named variable.
Depending on how tricky it is to fix, I may just add a check that the by variable is not named variable for the time being.
Hi,
I've noticed that using the
by
argument intbl_summary
won't work if the column I am summarizing by is named "variable". I'm assuming this is some kind of parsing issue. Things work fine when I change the variable name to group, see reprex below. I haven't taken a close look as to why this might be occurring. Thought an issue may be relevant as the default output of data.table'smelt
function (from wide to long) includes a column entitled variable.Created on 2022-05-03 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: