specify() also converts character variables chosen to be factors.

specify(x, formula, response = NULL, explanatory = NULL,
  success = NULL)

Arguments

x

A data frame that can be coerced into a tibble.

formula

A formula with the response variable on the left and the explanatory on the right.

response

The variable name in x that will serve as the response. This is alternative to using the formula argument.

explanatory

The variable name in x that will serve as the explanatory variable.

success

The level of response that will be considered a success, as a string. Needed for inference on one proportion, a difference in proportions, and corresponding z stats.

Value

A tibble containing the response (and explanatory, if specified) variable data.

Examples

# Permutation test similar to ANOVA mtcars %>% dplyr::mutate(cyl = factor(cyl)) %>% specify(mpg ~ cyl) %>% hypothesize(null = "independence") %>% generate(reps = 100, type = "permute") %>% calculate(stat = "F")
#> # A tibble: 100 x 2 #> replicate stat #> <int> <dbl> #> 1 1 0.975 #> 2 2 0.854 #> 3 3 0.414 #> 4 4 1.28 #> 5 5 0.912 #> 6 6 0.719 #> 7 7 1.24 #> 8 8 1.25 #> 9 9 0.643 #> 10 10 0.275 #> # ... with 90 more rows