Skip to content

Commit

Permalink
Made random category function exportable.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmueller18 committed Mar 11, 2024
1 parent 64a44a7 commit 6e5ccd0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export(lt.reproduction)
export(lt.sexrelation)
export(pop.sim.gomp)
export(prep.life.table)
export(random.cat)
export(random.cat.apply)
importFrom(Rdpack,reprompt)
importFrom(graphics,axis)
importFrom(graphics,grid)
Expand Down
7 changes: 5 additions & 2 deletions R/random_categories.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#' @examples
#' sim_ranges <- random.cat()

# generate random age ranges with 5 year ranges

#' @rdname random.cat.apply
#' @export
random.cat <- function(n_cat = 20, min_age = 15, max_cat_low = 60, max_age = 74) {
n_sim_ranges <- 0
seq_range_all <- NULL
Expand Down Expand Up @@ -59,7 +61,6 @@ random.cat <- function(n_cat = 20, min_age = 15, max_cat_low = 60, max_age = 74)
}



#' Applying random age ranges to individuals with absolute ages
#'
#' Helper function that applies random age categories to "known" absolute ages.
Expand Down Expand Up @@ -91,6 +92,8 @@ random.cat <- function(n_cat = 20, min_age = 15, max_cat_low = 60, max_age = 74)
#' # apply random age categories to simulated ages
#' sim_appl <- random.cat.apply(pop_sim$result, age = "age", age_ranges = sim_ranges, from = "from", to = "to")

#' @rdname random.cat.apply
#' @export
random.cat.apply <- function(x, age, age_ranges, from, to) {
asd <- data.frame(x)
max_age <- max(age_ranges['to'])
Expand Down
33 changes: 0 additions & 33 deletions man/random.cat.Rd

This file was deleted.

28 changes: 26 additions & 2 deletions man/random.cat.apply.Rd

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

0 comments on commit 6e5ccd0

Please sign in to comment.