Open yohei-h opened 3 weeks ago
I would like to display all levels in a factor variable using group_by(, .drop = F), but I cannot with tidytable::group_by(). Below is a sample code.
d <- iris library(tidyverse) library(tidytable) # I want to calculate the number of "XXX" # ------------------------------------------------------- d %>% mutate(Species = factor(Species, levels = c("setosa", "versicolor", "virginica", "XXX"))) %>% dplyr::group_by(Species, .drop = F) %>% dplyr::summarise(n = dplyr::n()) # But I cannot implement this using tidytable::group_by() # ------------------------------------------------------- d %>% mutate(Species = factor(Species, levels = c("setosa", "versicolor", "virginica", "XXX"))) %>% tidytable::group_by(Species) %>% tidytable::summarise(n = tidytable::n())
Is there a similar function in the tidytable package?
I would like to display all levels in a factor variable using group_by(, .drop = F), but I cannot with tidytable::group_by(). Below is a sample code.
Is there a similar function in the tidytable package?