-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee8f074
commit ad6177c
Showing
132 changed files
with
1,241 additions
and
666 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#' Augment Bootstrap Q | ||
#' | ||
#' @family Augment Function | ||
#' @family Bootstrap | ||
#' | ||
#' @author Steven P. Sanderson II, MPH | ||
#' | ||
#' @description | ||
#' Takes a numeric vector and will return the quantile. | ||
#' | ||
#' @details | ||
#' Takes a numeric vector and will return the quantile of that vector. | ||
#' This function is intended to be used on its own in order to add columns to a | ||
#' tibble. | ||
#' | ||
#' @param .data The data being passed that will be augmented by the function. | ||
#' @param .value This is passed [rlang::enquo()] to capture the vectors you want | ||
#' to augment. | ||
#' @param .names The default is "auto" | ||
#' | ||
#' @examples | ||
#' x <- mtcars$mpg | ||
#' | ||
#' tidy_bootstrap(x) %>% | ||
#' bootstrap_unnest_tbl() %>% | ||
#' bootstrap_q_augment(y) | ||
#' | ||
#' @return | ||
#' A augmented tibble | ||
#' | ||
#' @export | ||
#' | ||
|
||
bootstrap_q_augment <- function(.data, .value, .names = "auto"){ | ||
|
||
column_expr <- rlang::enquo(.value) | ||
|
||
if(rlang::quo_is_missing(column_expr)){ | ||
rlang::abort( | ||
message = "bootstrap_q_vec(.value) is missing", | ||
use_cli_format = TRUE | ||
) | ||
} | ||
|
||
col_nms <- names(tidyselect::eval_select(rlang::enquo(.value), .data)) | ||
|
||
make_call <- function(col){ | ||
rlang::call2( | ||
"bootstrap_q_vec", | ||
.x = rlang::sym(col), | ||
.ns = "TidyDensity" | ||
) | ||
} | ||
|
||
grid <- expand.grid( | ||
col = col_nms | ||
, stringsAsFactors = FALSE | ||
) | ||
|
||
calls <- purrr::pmap(.l = list(grid$col), make_call) | ||
|
||
if(any(.names == "auto")){ | ||
newname <- "q" | ||
} else { | ||
newname <- as.list(.names) | ||
} | ||
|
||
calls <- purrr::set_names(calls, newname) | ||
|
||
ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls)) | ||
|
||
return(ret) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#' Compute Bootstrap Q of a Vector | ||
#' | ||
#' @family Bootstrap | ||
#' @family Vector Function | ||
#' | ||
#' @author Steven P. Sanderson II, MPH | ||
#' | ||
#' @details | ||
#' A function to return the quantile of a vector. | ||
#' | ||
#' @description | ||
#' This function takes in a vector as it's input and will return the quantile | ||
#' of a vector. | ||
#' | ||
#' @param .x A numeric | ||
#' | ||
#' @examples | ||
#' x <- mtcars$mpg | ||
#' | ||
#' bootstrap_q_vec(x) | ||
#' | ||
#' @return | ||
#' A vector | ||
#' | ||
#' @export | ||
#' | ||
|
||
bootstrap_q_vec <- function(.x){ | ||
|
||
x_term <- .x | ||
n <- length(x_term) | ||
|
||
if (!is.numeric(.x)){ | ||
rlang::abort( | ||
message = "'.x' must be a numeric vector", | ||
use_cli_format = TRUE | ||
) | ||
} | ||
|
||
ret <- unname( | ||
stats::quantile(x_term, probs = seq(0, 1, 1 / (n - 1)), type = 1) | ||
) | ||
|
||
return(ret) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file modified
BIN
+22.5 KB
(110%)
docs/articles/getting-started_files/figure-html/more_than_nine_simulations-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15.4 KB
(110%)
docs/articles/getting-started_files/figure-html/more_than_nine_simulations-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.76 KB
(99%)
docs/articles/getting-started_files/figure-html/more_than_nine_simulations-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-10.6 KB
(95%)
docs/articles/getting-started_files/figure-html/more_than_nine_simulations-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-8.75 KB
(94%)
docs/articles/getting-started_files/figure-html/plot_density-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-743 Bytes
(99%)
docs/articles/getting-started_files/figure-html/plot_density-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+170 Bytes
(100%)
docs/articles/getting-started_files/figure-html/plot_density-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.43 KB
(100%)
docs/articles/getting-started_files/figure-html/plot_density-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.