Reputation: 7948
say I would like to use reporttools with tidyverse,
I first make sure the packages are loaded,
#install.packages("tidyverse", "reporttools") #Use this to install it, do this only once
library(reporttools); library(tidyverse)
Second I test it with a basic reporttools tableNominal
, i.e.,
data(CO2)
## the basic function
reporttools::tableNominal(vars = CO2[, 1:2], group = CO2[, "Treatment"])
That works.
Now, what is the correct way/best way to reference variables if I wish to use tidyverse to subset and select before using reporttools? Would be neat if I could use tidyverse's select helpers, e.g. contains()
, one_of()
CO2 %>% select(Plant, Type, Treatment) %>%
reporttools::tableNominal(vars = vars(Plant, Type), group = vars(Treatment))
Upvotes: 1
Views: 133