Skip to content

Commit

Permalink
Merge pull request #133 from spsanderson/development
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
spsanderson authored Nov 8, 2024
2 parents a057f64 + dfc6d0a commit 34f4301
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(generate_caption)
export(geometric_brownian_motion)
export(get_attributes)
export(kurtosis_vec)
export(rand_walk_column_names)
export(rand_walk_helper)
export(random_normal_drift_walk)
export(random_normal_walk)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# RandomWalker (development version)

## Breaing Changes
None

## New Features
1. Fix #105 - Add internal function `rand_walk_column_names()` to generate
column names for random walks.

## Minor Fixes and Improvements
1.

# RandomWalker 0.2.0

## Breaking Changes
Expand Down
38 changes: 38 additions & 0 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -554,3 +554,41 @@ get_attributes <- function(.data){
# Return
return(atb)
}

#' Get Column Names
#'
#' @family Utility Functions
#'
#' @author Steven P. Sanderson II, MPH
#'
#' @description This function generates the column names of a rand walk
#' data frame.
#'
#' @details The `rand_walk_column_names` function takes a data frame as input and
#' returns the rand walk data with column names.
#'
#' @keywords internal
#'
#' @param .rand_data A data frame from which column names are to be extracted.
#' @param .dim_names The dimnames passed from the rand walk function.
#'
#' @name rand_walk_column_names
NULL
#'
#' @rdname rand_walk_column_names
#'
#' @export

rand_walk_column_names <- function(.rand_data, .dim_names) {
# Set column names
rand_steps <- stats::setNames(.rand_data, .dim_names)
rand_steps <- purrr::map(rand_steps, \(x) dplyr::as_tibble(x)) |>
purrr::list_cbind()
colnames(rand_steps) <- .dim_names
rand_steps <- purrr::map(
rand_steps, \(x) x |>
unlist(use.names = FALSE)) |>
dplyr::as_tibble()

return(rand_steps)
}
1 change: 1 addition & 0 deletions man/convert_snake_to_title_case.Rd

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

1 change: 1 addition & 0 deletions man/generate_caption.Rd

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

1 change: 1 addition & 0 deletions man/get_attributes.Rd

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

39 changes: 39 additions & 0 deletions man/rand_walk_column_names.Rd

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

1 change: 1 addition & 0 deletions man/rand_walk_helper.Rd

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

1 change: 1 addition & 0 deletions man/running_quantile.Rd

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

1 change: 1 addition & 0 deletions man/std_cum_max_augment.Rd

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

1 change: 1 addition & 0 deletions man/std_cum_mean_augment.Rd

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

1 change: 1 addition & 0 deletions man/std_cum_min_augment.Rd

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

1 change: 1 addition & 0 deletions man/std_cum_prod_augment.Rd

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

1 change: 1 addition & 0 deletions man/std_cum_sum_augment.Rd

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

0 comments on commit 34f4301

Please sign in to comment.