statisfactions / simpr

Tidyverse-friendly simulations and power analysis
42 stars 6 forks source link

Document .$ syntax in fit() #25

Closed statisfactions closed 4 years ago

statisfactions commented 4 years ago

fit() can refer to individual column using .$colname syntax, e.g.

ind_t_spec = variables(y1 = ~ rnorm(n, mean = m + d*s, sd = s),
                       y2 = ~ rnorm(n, mean = m, sd = s)) %>%
  meta(n = 20, # n per grp
       m = 70, # ctrl grp mean
       d = .6, # exp - ctrl / sd (cohen's d)
       s = 10) # sd (both grps)

ind_t_gen = ind_t_spec %>%
  gen(1) %>%
  fit(ind_t_test = ~t.test(.$y1, .$y2, paired = FALSE, alternative = "two.sided"))

This should be documented, or an example added to the documentation.

jkbye commented 4 years ago

Added example to fit() documentation of how to use .$colname syntax instead of data = . when piping.