Skip to content

Commit

Permalink
Merge pull request #129 from spsanderson/development
Browse files Browse the repository at this point in the history
fixes for CRAN
  • Loading branch information
spsanderson authored Oct 23, 2024
2 parents f564b22 + 00b5551 commit 439cc9c
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 114 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.2.0
Date: 2024-10-23 01:14:59 UTC
SHA: 7d534be302fc0f099dcd42a4983b0b49d0bf3ca2
Date: 2024-10-23 12:54:05 UTC
SHA: 50e5591427422b48f58d03028ae9285bda4a1e21
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ Suggests:
knitr,
rmarkdown,
stats,
ggplot2
ggplot2,
tidyselect
VignetteBuilder: knitr
13 changes: 1 addition & 12 deletions R/auto-rw30.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,13 @@
#' `num_steps`, `mu`, and `sd` are attached to the tibble.
#'
#' @examples
#' library(ggplot2)
#'
#' # Generate random walks and print the result
#' set.seed(123)
#' rw30()
#'
#' set.seed(123)
#' rw30() |>
#' ggplot(aes(x = x, y = y, color = walk_number, group = walk_number)) +
#' geom_line() +
#' theme_minimal() +
#' theme(legend.position = "none") +
#' labs(
#' title = "30 Random Walks",
#' x = "Step",
#' y = "Value",
#' color = "Walk Number"
#' )
#' visualize_walks()
#'
#' @name rw30
NULL
Expand Down
10 changes: 2 additions & 8 deletions R/gen-brown-motion-geometric.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,12 @@
#' of class matrix will be returned.
#'
#' @examples
#' library(ggplot2)
#'
#' set.seed(123)
#' geometric_brownian_motion()
#'
#' set.seed(123)
#' geometric_brownian_motion() |>
#' ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) +
#' geom_line() +
#' labs(title = "Geometric Brownian Motion", x = "Time", y = "Value") +
#' theme_minimal() +
#' theme(legend.position = "none")
#' geometric_brownian_motion(.num_walks = 5) |>
#' visualize_walks()
#'
#' @return
#' A tibble/matrix
Expand Down
10 changes: 2 additions & 8 deletions R/gen-brown-motion.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@
#' of class matrix will be returned.
#'
#' @examples
#' library(ggplot2)
#'
#' set.seed(123)
#' brownian_motion()
#'
#' set.seed(123)
#' brownian_motion() |>
#' ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) +
#' geom_line() +
#' labs(title = "Brownian Motion", x = "Time", y = "Value") +
#' theme_minimal() +
#' theme(legend.position = "none")
#' brownian_motion(.num_walks = 5) |>
#' visualize_walks()
#'
#' @return
#' A tibble/matrix
Expand Down
9 changes: 3 additions & 6 deletions R/gen-discrete-walk.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@
#' discrete_walk()
#'
#' set.seed(123)
#' discrete_walk(.num_walks = 30, .n = 250, .upper_probability = 0.55) |>
#' ggplot(aes(x = x, y = cum_sum)) +
#' geom_line(aes(group = walk_number), alpha = .618, color = "steelblue") +
#' theme_minimal() +
#' theme(legend.position = "none") +
#' geom_smooth(method = "lm", se = FALSE)
#' discrete_walk(.num_walks = 10, .n = 250, .upper_probability = 0.51,
#' .initial_value = 100) |>
#' visualize_walks()
#'
#' @return
#' A tibble containing the simulated walks, with columns for the walk number,
Expand Down
12 changes: 3 additions & 9 deletions R/gen-random-normal-walk-drift.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@
#' @param .initial_value A numeric value indicating the initial value of the walks. Default is 0.
#'
#' @examples
#' library(ggplot2)
#'
#' set.seed(123)
#' walks <- random_normal_drift_walk(.num_walks = 10, .n = 50, .mu = 0, .sd = 1.2,
#' .drift = 0.05)
#' ggplot(walks, aes(x = x, y = y, group = walk_number, color = walk_number)) +
#' geom_line() +
#' labs(title = "Random Walks with Drift", x = "Time", y = "Value") +
#' theme_minimal() +
#' theme(legend.position = "none")
#' random_normal_drift_walk(.num_walks = 10, .n = 50, .mu = 0, .sd = 1.2,
#' .drift = 0.05, .initial_value = 100) |>
#' visualize_walks()
#'
#' @return A tibble in long format with columns `walk_number`, `x` (step index),
#' and `y` (walk value). The tibble has attributes for the number of walks,
Expand Down
8 changes: 2 additions & 6 deletions R/gen-random-normal-walk.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
#' random_normal_walk(.num_walks = 10, .n = 50, .samp = FALSE)
#'
#' set.seed(123)
#' random_normal_walk(.num_walks = 2, .n = 100) |>
#' ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) +
#' geom_line() +
#' labs(title = "Random Normal Walk", x = "Time", y = "Value") +
#' theme_minimal() +
#' theme(legend.position = "none")
#' random_normal_walk(.num_walks = 2, .n = 100, .initial_value = 100) |>
#' visualize_walks()
#'
#' @name random_normal_walk
NULL
Expand Down
10 changes: 5 additions & 5 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ std_cum_sum_augment <- function(.data,

calls <- purrr::set_names(calls, newname)

ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls))
ret <- dplyr::as_tibble(dplyr::mutate(.data, !!!calls))

return(ret)
}
Expand Down Expand Up @@ -307,7 +307,7 @@ std_cum_prod_augment <- function(.data,

calls <- purrr::set_names(calls, newname)

ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls))
ret <- dplyr::as_tibble(dplyr::mutate(.data, !!!calls))

return(ret)
}
Expand Down Expand Up @@ -375,7 +375,7 @@ std_cum_min_augment <- function(.data,

calls <- purrr::set_names(calls, newname)

ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls))
ret <- dplyr::as_tibble(dplyr::mutate(.data, !!!calls))

return(ret)
}
Expand Down Expand Up @@ -443,7 +443,7 @@ std_cum_max_augment <- function(.data,

calls <- purrr::set_names(calls, newname)

ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls))
ret <- dplyr::as_tibble(dplyr::mutate(.data, !!!calls))

return(ret)
}
Expand Down Expand Up @@ -511,7 +511,7 @@ std_cum_mean_augment <- function(.data,

calls <- purrr::set_names(calls, newname)

ret <- tibble::as_tibble(dplyr::mutate(.data, !!!calls))
ret <- dplyr::as_tibble(dplyr::mutate(.data, !!!calls))

return(ret)
}
Expand Down
8 changes: 4 additions & 4 deletions R/plt-visualize-walks.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' liking.
#'
#' You can also choose whether you want the visualization to be interactive or
#' not by setting `.interactive` to TRUE. The function uses the {ggiraph}
#' not by setting `.interactive` to TRUE. The function uses the `ggiraph`
#' package for making the patches interactive.
#'
#' If you want to visualize only one of the attributes, you can choose use one of
Expand Down Expand Up @@ -61,17 +61,17 @@
#'
#' # Use the function with an input that has alternatives for y
#' set.seed(123)
#' random_normal_walk() |>
#' random_normal_walk(.num_walks = 5, .initial_value = 100) |>
#' visualize_walks()
#'
#' # Use the function to create interactive visualizations
#' set.seed(123)
#' random_normal_walk() |>
#' random_normal_walk(.num_walks = 5, .initial_value = 100) |>
#' visualize_walks(.interactive = TRUE)
#'
#' # Use .pluck to pick just one visualization
#' set.seed(123)
#' random_normal_walk() |>
#' random_normal_walk(.num_walks = 5, .initial_value = 100) |>
#' visualize_walks(.pluck = "cum_sum")
#'
#' @name visualize_walks
Expand Down
10 changes: 2 additions & 8 deletions man/brownian_motion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions man/discrete_walk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions man/geometric_brownian_motion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/random_normal_drift_walk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions man/random_normal_walk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions man/rw30.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/visualize_walks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 439cc9c

Please sign in to comment.