Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ logo_script.R
check funs.R
inst/figure
Thumbs.db
^wakefield\.Rproj$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
135 changes: 103 additions & 32 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,110 @@ Package: wakefield
Title: Generate Random Data Sets
Version: 0.3.7
Authors@R: c(
person("Tyler", "Rinker", email = "tyler.rinker@gmail.com", role = c("aut", "cre")),
person("Josh", "O'Brien", role = "ctb"),
person("Ananda", "Mahto", role = "ctb"),
person("Matthew", "Sigal", role = "ctb"),
person("Jonathan", "Carroll", role = "ctb"),
person("Scott", "Westenberger", role = "ctb")
)
person("Tyler", "Rinker", , "tyler.rinker@gmail.com", role = c("aut", "cre")),
person("Josh", "O'Brien", role = "ctb"),
person("Ananda", "Mahto", role = "ctb"),
person("Matthew", "Sigal", role = "ctb"),
person("Jonathan", "Carroll", role = "ctb"),
person("Scott", "Westenberger", role = "ctb")
)
Maintainer: Tyler Rinker <tyler.rinker@gmail.com>
Description: Generates random data sets including: data.frames, lists,
and vectors.
Depends: R (>= 3.2.0)
Imports: chron, ggplot2, dplyr, stringi
Suggests: testthat
Description: Generates random data sets including: data.frames, lists, and
vectors.
License: GPL-2
LazyData: TRUE
URL: https://github.com/trinker/wakefield
BugReports: https://github.com/trinker/wakefield/issues
Roxygen: list(wrap = FALSE)
Collate: 'utils.R' 'r_sample.R' 'age.R' 'r_sample_factor.R' 'animal.R'
'r_sample_binary.R' 'answer.R' 'area.R' 'as_integer.R' 'car.R'
'children.R' 'coin.R' 'color.R' 'date_stamp.R'
'r_sample_logical.R' 'death.R' 'dice.R' 'dna.R' 'dob.R'
'dummy.R' 'education.R' 'employment.R' 'eye.R' 'grade.R'
'grade_level.R' 'group.R' 'hair.R' 'normal.R' 'height.R'
'hour.R' 'id.R' 'income.R' 'internet_browser.R' 'interval.R'
'iq.R' 'language.R' 'level.R' 'r_sample_ordered.R' 'likert.R'
'lorem_ipsum.R' 'marital.R' 'military.R' 'minute.R' 'month.R'
'r_sample_replace.R' 'wakefield-package.R' 'name.R' 'peek.R'
'political.R' 'probs.R' 'r_data.R' 'r_data_frame.R' 'r_dummy.R'
'seriesname.R' 'r_insert.R' 'r_list.R' 'r_na.R'
'r_sample_integer.R' 'r_series.R' 'race.R' 'relate.R'
'religion.R' 'sat.R' 'second.R' 'sentence.R' 'sex.R'
'sex_inclusive.R' 'smokes.R' 'speed.R' 'state.R' 'string.R'
'table_heat.R' 'time_stamp.R' 'upper.R' 'valid.R' 'variables.R'
'varname.R' 'year.R' 'zip_code.R'
RoxygenNote: 7.1.1
Depends:
R (>= 3.2.0)
Imports:
chron,
tibble,
stringi
Suggests:
dplyr,
ggplot2,
testthat
Encoding: UTF-8
LazyData: TRUE
RoxygenNote: 7.2.1
Collate:
'utils.R'
'r_sample.R'
'age.R'
'r_sample_factor.R'
'animal.R'
'r_sample_binary.R'
'answer.R'
'area.R'
'as_integer.R'
'car.R'
'children.R'
'coin.R'
'color.R'
'date_stamp.R'
'r_sample_logical.R'
'death.R'
'dice.R'
'dna.R'
'dob.R'
'dummy.R'
'education.R'
'employment.R'
'eye.R'
'grade.R'
'grade_level.R'
'group.R'
'hair.R'
'normal.R'
'height.R'
'hour.R'
'id.R'
'income.R'
'internet_browser.R'
'interval.R'
'iq.R'
'language.R'
'level.R'
'r_sample_ordered.R'
'likert.R'
'lorem_ipsum.R'
'marital.R'
'military.R'
'minute.R'
'month.R'
'r_sample_replace.R'
'wakefield-package.R'
'name.R'
'peek.R'
'political.R'
'probs.R'
'r_data.R'
'r_data_frame.R'
'r_dummy.R'
'seriesname.R'
'r_insert.R'
'r_list.R'
'r_na.R'
'r_sample_integer.R'
'r_series.R'
'race.R'
'relate.R'
'religion.R'
'sat.R'
'second.R'
'sentence.R'
'sex.R'
'sex_inclusive.R'
'smokes.R'
'speed.R'
'state.R'
'string.R'
'table_heat.R'
'time_stamp.R'
'upper.R'
'valid.R'
'variables.R'
'varname.R'
'year.R'
'zip_code.R'
Roxygen: list(markdown = TRUE)
14 changes: 7 additions & 7 deletions R/animal.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate Random Vector of animals
#'
#' \code{animal} - Generate a random vector of animals.
#' `animal` - Generate a random vector of animals.
#'
#' @inheritParams color
#' @return Returns a random factor vector of animal elements.
Expand Down Expand Up @@ -29,16 +29,16 @@ animal <- function(n, k = 10, x = wakefield::animal_list, prob = NULL, name = "A

#' Generate Random Vector of animals
#'
#' \code{pet} - Generate a random vector of pets.
#' `pet` - Generate a random vector of pets.
#'
#' @details The household pets and probabilities:
#'
#' \tabular{ll}{
#' Dog \tab 36.5 \%\cr
#' Cat \tab 30.4 \%\cr
#' None \tab 25.8 \%\cr
#' Bird \tab 3.1 \% \cr
#' Horse \tab 1.5 \% \cr
#' Dog \tab 36.5 %\cr
#' Cat \tab 30.4 %\cr
#' None \tab 25.8 %\cr
#' Bird \tab 3.1 % \cr
#' Horse \tab 1.5 % \cr
#' }
#'
#' @export
Expand Down
18 changes: 9 additions & 9 deletions R/as_integer.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#' Convert a Factor Data Frame to Integer
#'
#' Converts a \code{\link[base]{data.frame}} of \code{\link[base]{factor}}s to
#' Converts a [base::data.frame()] of [base::factor()]s to
#' integers.
#'
#' @param x A \code{\link[base]{data.frame}} of \code{\link[base]{factor}}s.
#' @param cols Numeric indices of the columns to incude (use \code{-} to exclude
#' as well). Default is to assign random \code{NA}s to all columns except the
#' @param x A [base::data.frame()] of [base::factor()]s.
#' @param cols Numeric indices of the columns to incude (use `-` to exclude
#' as well). Default is to assign random `NA`s to all columns except the
#' first column.
#' @param fun An \code{as.} coercion function to apply to each column. Default
#' is \code{\link[base]{as.integer}}.
#' @return Returns a \code{\link[base]{data.frame}} equal to the
#' \code{\link[base]{class}} of \code{x} with integer columns rather than factor.
#' @param fun An `as.` coercion function to apply to each column. Default
#' is [base::as.integer()].
#' @return Returns a [base::data.frame()] equal to the
#' [base::class()] of `x` with integer columns rather than factor.
#' @keywords integer numeric
#' @export
#' @seealso \code{\link[wakefield]{r_series}}
#' @seealso [wakefield::r_series()]
#' @examples
#' as_integer(r_series(likert_7, 5, 10))
#' as_integer(r_series(likert_7, 5, 10), cols = c(2, 4))
Expand Down
2 changes: 1 addition & 1 deletion R/car.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate Random Vector of Cars
#'
#' Generate a random vector of cars (see \code{?\link[datasets]{mtcars}}).
#' Generate a random vector of cars (see `?[mtcars][datasets::mtcars]`).
#'
#' @inheritParams r_sample_factor
#' @return Returns a random vector of car elements.
Expand Down
14 changes: 7 additions & 7 deletions R/color.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#' Generate Random Vector of Colors
#'
#' \code{color} - Generate a random vector of colors (sampled from \code{colors()}).
#' `color` - Generate a random vector of colors (sampled from `colors()`).
#'
#' @param n The number elements to generate. This can be globally set within
#' the environment of \code{r_data_frame} or \code{r_list}.
#' @param k The number of the elements of x to sample from (uses \code{sample(x, k)}).
#' the environment of `r_data_frame` or `r_list`.
#' @param k The number of the elements of x to sample from (uses `sample(x, k)`).
#' @param x A vector of elements to chose from.
#' @param prob A vector of probabilities to chose from.
#' @param name The name to assign to the output vector's \code{varname}
#' @param name The name to assign to the output vector's `varname`
#' attribute. This is used to auto assign names to the column/vector name when
#' used inside of \code{r_data_frame} or \code{r_list}.
#' used inside of `r_data_frame` or `r_list`.
#' @return Returns a random factor vector of color elements.
#' @keywords color
#' @export
Expand Down Expand Up @@ -37,8 +37,8 @@ color <- function(n, k = 10, x = grDevices::colors(), prob = NULL, name = "Color

#' Generate Random Vector of Colors
#'
#' \code{color} - Generate a random vector of \emph{psycological primary}
#' colors (sampled from \code{colors()}).
#' `color` - Generate a random vector of *psycological primary*
#' colors (sampled from `colors()`).
#'
#' @export
#' @rdname color
Expand Down
24 changes: 12 additions & 12 deletions R/date_stamp.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
#' Generate a random vector of dates.
#'
#' @param n The number elements to generate. This can be globally set within
#' the environment of \code{r_data_frame} or \code{r_list}.
#' @param random logical. If \code{TRUE} the dates are randomized, otherwise the
#' the environment of `r_data_frame` or `r_list`.
#' @param random logical. If `TRUE` the dates are randomized, otherwise the
#' dates are sequential.
#' @param x A vector of elements to chose from. This may be \code{NULL} if
#' arguments are supplied to \code{start}, \code{k}, and \code{by}. The
#' \code{x} argument takes precedence over the other three if \code{!is.null}.
#' Note that \code{start}, \code{k}, and \code{by} work together to make a
#' vector of dates to sample from. See \code{\link[base]{seq.Date}} for
#' @param x A vector of elements to chose from. This may be `NULL` if
#' arguments are supplied to `start`, `k`, and `by`. The
#' `x` argument takes precedence over the other three if `!is.null`.
#' Note that `start`, `k`, and `by` work together to make a
#' vector of dates to sample from. See [base::seq.Date()] for
#' additional information.
#' @param start A date to start the sequence at.
#' @param k The length of the sequence (number of the elements) so build out from
#' \code{start}.
#' `start`.
#' @param by The interval to use in building the sequence.
#' @param prob A vector of probabilities to chose from.
#' @param name The name to assign to the output vector's \code{varname}
#' @param name The name to assign to the output vector's `varname`
#' attribute. This is used to auto assign names to the column/vector name when
#' used inside of \code{r_data_frame} or \code{r_list}.
#' used inside of `r_data_frame` or `r_list`.
#' @return Returns a random factor vector of date elements.
#' @keywords date
#' @export
#' @seealso \code{\link[base]{seq.Date}}
#' @seealso [base::seq.Date()]
#' @family variable functions
#' @examples
#' date_stamp(10)
Expand All @@ -35,7 +35,7 @@ date_stamp <- function(n, random = FALSE, x = NULL, start = Sys.Date(), k = 12,
by = "-1 months", prob = NULL, name = "Date"){

if (is.null(x)){
x <- seq(start, length = k, by = by)
x <- seq(start, length.out = k, by = by)
}

if (!inherits(x, c("Date", "POSIXct", "POSIXt"))) warning("`x`may not a date vector")
Expand Down
2 changes: 1 addition & 1 deletion R/death.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate Random Vector of Deaths Outcomes
#'
#' Generate a random logical vector of deaths (\code{TRUE}/\code{FALSE}).
#' Generate a random logical vector of deaths (`TRUE`/`FALSE`).
#'
#' @inheritParams dummy
#' @return Returns a random logical vector of death outcome elements.
Expand Down
2 changes: 1 addition & 1 deletion R/dob.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dob <- function(n, random = TRUE, x = NULL, start = Sys.Date() - 365*15,
k = 365*2, by = "1 days", prob = NULL, name = "DOB"){

if (is.null(x)){
x <- seq(start, length = k, by = by)
x <- seq(start, length.out = k, by = by)
}

if (!inherits(x, c("Date", "POSIXct", "POSIXt"))) warning("`x`may not a date vector")
Expand Down
8 changes: 4 additions & 4 deletions R/dummy.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#' Generate a random dummy coded (0/1) vector.
#'
#' @param n The number elements to generate. This can be globally set within
#' the environment of \code{r_data_frame} or \code{r_list}.
#' the environment of `r_data_frame` or `r_list`.
#' @param prob A vector of probabilities to chose from.
#' @param name The name to assign to the output vector's \code{varname}
#' @param name The name to assign to the output vector's `varname`
#' attribute. This is used to auto assign names to the column/vector name when
#' used inside of \code{r_data_frame} or \code{r_list}.
#' used inside of `r_data_frame` or `r_list`.
#' @return Returns a random dummy vector of (0/1) elements.
#' @seealso \code{\link[base]{sample.int}}
#' @seealso [base::sample.int()]
#' @family variable functions
#' @export
#' @examples
Expand Down
Loading