Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use \describe{} in messy_linelist ... documentation #196

Merged
merged 2 commits into from
Feb 19, 2025
Merged
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: 1 addition & 1 deletion R/checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
#' the class of the object, in other words, it does not check the object is
#' of class `<linelist>`.
#'
#' @inheritParams truncate_linelist
#' @inheritParams messy_linelist
#'
#' @return Invisibly return the `linelist` `<data.frame>`. The function is
#' called for its side-effects, which will error if the input is invalid.
Expand Down
35 changes: 18 additions & 17 deletions R/messy_linelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,22 @@
#' mistakes and inconsistencies, as well as coerce date types.
#'
#' @param linelist Line list `<data.frame>` output from [sim_linelist()].
#' @inheritParams create_config
#'
#' @details
#' By default `messy_linelist()`:
#'
#' * Makes 10% of values missing, i.e. converts to `NA`.
#' * Introduces spelling mistakes in 10% of `character` columns.
#' * Introduce inconsistency in the reporting of `$sex`.
#' * Converts `numeric` columns (`double` & `integer`) to `character`.
#' * Converts `Date` columns to `character`.
#' * Converts `integer` columns to (English) words.
#' * Duplicates 1% of rows
#'
#' To change the defaults of `messy_linelist()` arguments can be supplied
#' to `...`.
#' @param ... <[`dynamic-dots`][rlang::dyn-dots]> Named elements to replace
#' default settings. Only if names match exactly are elements replaced,
#' otherwise the function errors.
#'
#' Accepted arguments and their defaults are:
#'
#' \describe{
#' \item{`prop_missing`}{A `numeric` between 0 and 1 for the proportion of
#' missing values. Default is `0.1` (10%).}
#' missing values. Default is `0.1` (10%).
#' }
#' \item{`missing_value`}{A single atomic \R object used to represent missing
#' values. Default is `NA`.}
#' \item{`prop_spelling_mistakes`}{A `numeric` between 0 and 1 used to
#' specify the proportion of spelling mistakes in `character` columns.
#' Default is `0.1` (10%).}
#' Default is `0.1` (10%).
#' }
#' \item{`inconsistent_sex`}{A `logical` boolean to specify whether the
#' `$sex` column uses `"m"` and `"f"`, or inconsistently uses `"m"`, `"f"`,
#' `"M"`, `"F"`, `"male"`, `"female"`, `"Male"` or `"Female"`. Default
Expand All @@ -57,6 +47,17 @@
#' be duplicated.}
#' }
#'
#' @details
#' By default `messy_linelist()`:
#'
#' * Makes 10% of values missing, i.e. converts to `NA`.
#' * Introduces spelling mistakes in 10% of `character` columns.
#' * Introduce inconsistency in the reporting of `$sex`.
#' * Converts `numeric` columns (`double` & `integer`) to `character`.
#' * Converts `Date` columns to `character`.
#' * Converts `integer` columns to (English) words.
#' * Duplicates 1% of rows
#'
#' When setting `sex_as_numeric` to `TRUE`, male is set to `0` and female
#' to `1`. Only one of `inconsistent_sex` or `sex_as_numeric` can be `TRUE`,
#' otherwise the function will error.
Expand Down
2 changes: 1 addition & 1 deletion R/truncate_linelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' to the variability in the reporting delays. See examples for variable or
#' fixed `delay` functions.
#'
#' @param linelist A `<data.frame>` output from [sim_linelist()].
#' @inheritParams messy_linelist
#' @param delay A `function` (either anonymous or predefined) that
#' has a single argument and generates random numbers given a probability
#' distribution. The function must return a vector of real numbers for
Expand Down
2 changes: 1 addition & 1 deletion man/dot-check_linelist.Rd

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

51 changes: 25 additions & 26 deletions man/messy_linelist.Rd

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

2 changes: 1 addition & 1 deletion man/truncate_linelist.Rd

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

Loading