Skip to content

Commit 06e2977

Browse files
authored
merge pr #453: v1.0.2 release candidate
2 parents 736e934 + bbd8c2b commit 06e2977

File tree

4 files changed

+27
-29
lines changed

4 files changed

+27
-29
lines changed

DESCRIPTION

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Type: Package
22
Package: infer
33
Title: Tidy Statistical Inference
4-
Version: 1.0.1.9000
4+
Version: 1.0.2
55
Authors@R:
66
c(person(given = "Andrew",
77
family = "Bray",
8-
role = c("aut", "cre"),
8+
role = "aut",
99
email = "abray@reed.edu"),
1010
person(given = "Chester",
1111
family = "Ismay",
@@ -19,7 +19,7 @@ Authors@R:
1919
comment = c(ORCID = "0000-0002-1617-4019")),
2020
person(given = "Simon",
2121
family = "Couch",
22-
role = "aut",
22+
role = c("aut", "cre"),
2323
email = "simonpatrickcouch@gmail.com",
2424
comment = c(ORCID = "0000-0001-5676-5107")),
2525
person(given = "Ben",

NEWS.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# infer v1.0.1.9000 (Development Version)
2-
3-
To be released as v1.0.2.
4-
1+
# infer v1.0.2
52

63
* Fix p-value shading when the calculated statistic falls exactly on the boundaries of a histogram bin (#424).
74
* Fix `generate()` errors when columns are named `x` (#431).

R/wrappers.R

+20-20
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ t_test <- function(x, formula,
5757
conf_int = TRUE,
5858
conf_level = 0.95,
5959
...) {
60-
60+
6161
check_conf_level(conf_level)
6262

6363
# convert all character and logical variables to be factor variables
@@ -170,7 +170,7 @@ t_stat <- function(x, formula,
170170
msg = c("The t_stat() wrapper has been deprecated in favor of the more " ,
171171
"general observe(). Please use that function instead.")
172172
)
173-
173+
174174
check_conf_level(conf_level)
175175

176176
# convert all character and logical variables to be factor variables
@@ -256,9 +256,9 @@ chisq_test <- function(x, formula, response = NULL,
256256
# Parse response and explanatory variables
257257
response <- enquo(response)
258258
explanatory <- enquo(explanatory)
259-
259+
260260
x <- standardize_variable_types(x)
261-
261+
262262
x <- parse_variables(x = x, formula = formula,
263263
response = response, explanatory = explanatory)
264264

@@ -290,7 +290,7 @@ chisq_test <- function(x, formula, response = NULL,
290290
#'
291291
#' A shortcut wrapper function to get the observed test statistic for a chisq
292292
#' test. Uses [chisq.test()][stats::chisq.test()], which applies a continuity
293-
#' correction. This function has been deprecated in favor of the more
293+
#' correction. This function has been deprecated in favor of the more
294294
#' general [observe()].
295295
#'
296296
#' @param x A data frame that can be coerced into a [tibble][tibble::tibble].
@@ -327,15 +327,15 @@ chisq_stat <- function(x, formula, response = NULL,
327327
explanatory = NULL, ...) {
328328
.Deprecated(
329329
new = "observe",
330-
msg = c("The chisq_stat() wrapper has been deprecated in favor of the ",
330+
msg = c("The chisq_stat() wrapper has been deprecated in favor of the ",
331331
"more general observe(). Please use that function instead.")
332332
)
333-
333+
334334
# Parse response and explanatory variables
335335
response <- enquo(response)
336336
explanatory <- enquo(explanatory)
337337
x <- standardize_variable_types(x)
338-
338+
339339
x <- parse_variables(x = x, formula = formula,
340340
response = response, explanatory = explanatory)
341341

@@ -364,7 +364,7 @@ chisq_stat <- function(x, formula, response = NULL,
364364

365365
check_conf_level <- function(conf_level) {
366366
if (
367-
(class(conf_level) != "numeric") | (conf_level < 0) | (conf_level > 1)
367+
(!inherits(conf_level, "numeric")) | (conf_level < 0) | (conf_level > 1)
368368
) {
369369
stop_glue("The `conf_level` argument must be a number between 0 and 1.")
370370
}
@@ -409,8 +409,8 @@ check_conf_level <- function(conf_level) {
409409
#' a string. Only used when testing the null that a single
410410
#' proportion equals a given value, or that two proportions are equal;
411411
#' ignored otherwise.
412-
#' @param correct A logical indicating whether Yates' continuity correction
413-
#' should be applied where possible. If `z = TRUE`, the `correct` argument will
412+
#' @param correct A logical indicating whether Yates' continuity correction
413+
#' should be applied where possible. If `z = TRUE`, the `correct` argument will
414414
#' be overwritten as `FALSE`. Otherwise defaults to `correct = TRUE`.
415415
#' @param z A logical value for whether to report the statistic as a standard
416416
#' normal deviate or a Pearson's chi-square statistic. \eqn{z^2} is distributed
@@ -431,7 +431,7 @@ check_conf_level <- function(conf_level) {
431431
#' prop_test(gss,
432432
#' college ~ NULL,
433433
#' p = .2)
434-
#'
434+
#'
435435
#' # report as a z-statistic rather than chi-square
436436
#' # and specify the success level of the response
437437
#' prop_test(gss,
@@ -458,10 +458,10 @@ prop_test <- function(x, formula,
458458
response <- enquo(response)
459459
explanatory <- enquo(explanatory)
460460
x <- standardize_variable_types(x)
461-
461+
462462
x <- parse_variables(x = x, formula = formula,
463463
response = response, explanatory = explanatory)
464-
464+
465465
correct <- if (z) {FALSE} else if (is.null(correct)) {TRUE} else {correct}
466466

467467
if (!(class(response_variable(x)) %in% c("logical", "character", "factor"))) {
@@ -535,7 +535,7 @@ prop_test <- function(x, formula,
535535
p = p,
536536
correct = correct,
537537
...)
538-
538+
539539
}
540540

541541
if (length(prelim$estimate) <= 2) {
@@ -563,7 +563,7 @@ prop_test <- function(x, formula,
563563
chisq_df = parameter,
564564
p_value = p.value)
565565
}
566-
566+
567567
if (z) {
568568
results <- calculate_z(x, results, success, p, order)
569569
}
@@ -573,9 +573,9 @@ prop_test <- function(x, formula,
573573

574574
calculate_z <- function(x, results, success, p, order) {
575575
exp <- if (has_explanatory(x)) {explanatory_name(x)} else {"NULL"}
576-
576+
577577
form <- as.formula(paste0(response_name(x), " ~ ", exp))
578-
578+
579579
stat <- x %>%
580580
specify(formula = form, success = success) %>%
581581
hypothesize(
@@ -587,9 +587,9 @@ calculate_z <- function(x, results, success, p, order) {
587587
order = if (has_explanatory(x)) {order} else {NULL}
588588
) %>%
589589
dplyr::pull()
590-
590+
591591
results$statistic <- stat
592592
results$chisq_df <- NULL
593-
593+
594594
results
595595
}

man/infer.Rd

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)