R/getTypeStrings.R

Defines functions getTypeStringsAll getTypeStringsNumeric getTypeStringsNumericStrict getTypeStringsInteger getTypeStringsCharacter getTypeStringsDiscrete getTypeStringsLogical

Documented in getTypeStringsAll getTypeStringsCharacter getTypeStringsDiscrete getTypeStringsInteger getTypeStringsLogical getTypeStringsNumeric getTypeStringsNumericStrict

#' @title Get parameter type-strings.
#' @description
#' Returns type strings used in `param$type` for certain groups of parameters.
#' @template arg_include_int
#' @template arg_include_logical
#' @return [`character`].
#' @name getTypeStrings
#' @rdname getTypeStrings
NULL

#' @export
#' @rdname getTypeStrings
getTypeStringsAll = function() {
  ph$type.strings
}

#' @export
#' @rdname getTypeStrings
getTypeStringsNumeric = function(include.int = TRUE) {
  if (include.int) {
    ph$type.strings.numeric
  } else {
    ph$type.strings.double
  }
}

#' @export
#' @rdname getTypeStrings
getTypeStringsNumericStrict = function() {
  ph$type.strings.double
}

#' @export
#' @rdname getTypeStrings
getTypeStringsInteger = function() {
  ph$type.strings.integer
}

#' @export
#' @rdname getTypeStrings
getTypeStringsCharacter = function() {
  ph$type.strings.character
}

#' @export
#' @rdname getTypeStrings
getTypeStringsDiscrete = function(include.logical = TRUE) {
  if (include.logical) {
    c(ph$type.strings.discrete, ph$type.strings.logical)
  } else {
    ph$type.strings.discrete
  }
}

#' @export
#' @rdname getTypeStrings
getTypeStringsLogical = function() {
  ph$type.strings.logical
}

Try the ParamHelpers package in your browser

Any scripts or data that you put into this service are public.

ParamHelpers documentation built on March 26, 2020, 7:40 p.m.