Installation

devtools::install_github('artichaud1/twoway')

Usage

library(dplyr)
library(twoway)

data <- data_frame(
  x = runif(1000),
  g1 = sample(c('a', 'b'), 1000, replace = TRUE),
  g2 = sample(c('U', 'V'), 1000, replace = TRUE),
  g3 = sample(c('G3_1', 'G3_2'), 1000, replace = TRUE),
  y = runif(1000),
  w = sample(1:5, 1000, replace = TRUE),
  e = sample(1:2, 1000, replace = TRUE)
)

twoway(data, 
       target = 'y', 
       var = 'g1',
       var2 = 'g2',
       weight = 'w',
       exposure = 'e') %>% 
  show(title = 'Example 1')

twoway(data, 
       target = 'y', 
       var = 'g1',
       var2 = 'x',
       weight = 'w', 
       exposure = 'e', 
       quantiles2 = 3,
       labels2 = paste('x:', c('low', 'medium', 'high'))) %>%
  show(title = 'Example 2')


artichaud1/twoway documentation built on May 12, 2019, 5:43 a.m.