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
Using reactable() on a dplyr grouped data frame ( dplyr::group_by() or grouped_df) with rownames = TRUE no longer adds a stringsAsFactors column to the table (@daattali, #283).
This was a really weird issue. For some reason, cbind(..., stringsAsFactors = FALSE) works on data.frames, but not dplyr's grouped_df. Depending on how you interpret cbind(), I guess it could be more of a bug with dplyr's dplyr:::cbind.grouped_df() method. ?cbind says..
... For the "data.frame" method of cbind these can be further arguments to data.frame such as stringsAsFactors.
Here's a minimal repro of cbind()ing a data frame and then a grouped_df:
cbind(x="a", data.frame(y=2), stringsAsFactors=FALSE)
# x y# 1 a 2
cbind(x="a", dplyr::grouped_df(data.frame(y=2), "y"), stringsAsFactors=FALSE)
# # A tibble: 1 x 3# x y stringsAsFactors# <chr> <dbl> <lgl> # 1 a 2 FALSE
If you think so, you can report it on dplyr's issue tracker as well, but I imagine very few users are going to be using stringsAsFactors with tibbles/grouped_df anyway.
For a workaround, you can ungroup the data frame to turn it back into a regular tibble:
This bug happens whenever you use a
dplyr::group_by()
with more than one grouping variable and also usereactable(rownames = TRUE)
If you set
rownames = FALSE
or you group by only one variable, this doesn't happenThe text was updated successfully, but these errors were encountered: