Skip to content

Commit

Permalink
clean up some roxygen documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Jan 10, 2021
1 parent 2dc7cc0 commit 0edb0f4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 37 deletions.
24 changes: 19 additions & 5 deletions R/utililties.R
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@
##' Names of any factor variables in model data
##'
##' @param df a data frame or tibble
##'
##' @noRd
`factor_var_names` <- function(df) {
ind <- is_factor_var(df)
result <- if (any(ind)) {
Expand All @@ -629,12 +631,16 @@
##' Vectorised checks for variable types
##'
##' @param df a data frame or tibble
##'
##' @noRd
`is_factor_var` <- function(df) {
result <- vapply(df, is.factor, logical(1L))
result
}

##' @rdname is_factor_var
##'
##' @noRd
`is_numeric_var` <- function(df) {
result <- vapply(df, is.numeric, logical(1L))
result
Expand Down Expand Up @@ -885,7 +891,7 @@
##' Names of variables involved in a specified model term
##'
##' Given the name (a term label) of a term in a model, returns the names
##' of the variables involved in ther term.
##' of the variables involved in the term.
##'
##' @param object an R object on which method dispatch is performed
##' @param term character; the name of a model term, in the sense of
Expand Down Expand Up @@ -956,12 +962,16 @@ vars_from_label <- function(label) {
##' @param constant the constant to add.
##' @param ... additional arguments passed to methods.
##'
##' @return Returns `object` but with the estimate shifted by the addition of
##' the supplied constant.
##'
##' @author Gavin L. Simpson
`add_constant` <- function(object, constant = NULL, ...) {
UseMethod("add_constant")
}

##' @rdname add_constant
`add_constant.evaluated_smooth` <- function(object, constant = NULL, ...) {

## If constant supplied, add it to `est`
if (!is.null(constant)) {
if (!is.numeric(constant)) {
Expand All @@ -974,8 +984,8 @@ vars_from_label <- function(label) {
object
}

##' @rdname add_constant
`add_constant.evaluated_parametric_term` <- function(object, constant = NULL, ...) {

## If constant supplied, add it to `est`
if (!is.null(constant)) {
if (!is.numeric(constant)) {
Expand All @@ -994,12 +1004,16 @@ vars_from_label <- function(label) {
##' @param fun the function to apply.
##' @param ... additional arguments passed to methods.
##'
##' @return Returns `object` but with the estimate and upper and lower values
##' of the confidence interval transformed via the function.
##'
##' @author Gavin L. Simpson
`transform_fun` <- function(object, fun = NULL , ...) {
UseMethod("add_constant")
}

##' @rdname transform_fun
`transform_fun.evaluated_smooth` <- function(object, fun = NULL, ...) {

## If fun supplied, use it to transform est and the upper and lower interval
if (!is.null(fun)) {
fun <- match.fun(fun)
Expand All @@ -1015,8 +1029,8 @@ vars_from_label <- function(label) {
object
}

##' @rdname transform_fun
`transform_fun.evaluated_parametric_term` <- function(object, fun = NULL, ...) {

## If fun supplied, use it to transform est and the upper and lower interval
if (!is.null(fun)) {
fun <- match.fun(fun)
Expand Down
13 changes: 13 additions & 0 deletions man/add_constant.Rd

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

14 changes: 0 additions & 14 deletions man/factor_var_names.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/is_factor_var.Rd

This file was deleted.

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

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

13 changes: 13 additions & 0 deletions man/transform_fun.Rd

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

0 comments on commit 0edb0f4

Please sign in to comment.