1

say I would like to use with ,

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 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 to subset and select before using ? Would be neat if I could use 's select helpers, e.g. contains(), one_of()

CO2 %>% select(Plant, Type, Treatment) %>% 
     reporttools::tableNominal(vars = vars(Plant, Type), group =  vars(Treatment))
phiver
  • 23,048
  • 14
  • 44
  • 56
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
  • `%>% { reporttools::tableNominal(vars = .[c("Plant", "Type")], group = .["Treatment"]) }` ? – Axeman Feb 21 '18 at 12:22
  • Thanks. Would it be possible to code it in a way that allowed me to use [tidyverse's _select helpers_, e.g `starts_with()`](http://dplyr.tidyverse.org/reference/select_helpers.html)? – Eric Fail Feb 21 '18 at 12:47
  • You'll have to rewrite the `tableNominal` function, or write a wrapper around it. – Axeman Feb 21 '18 at 12:47

0 Answers0