File: isTypeString.R

package info (click to toggle)
r-cran-paramhelpers 1.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 992 kB
  • sloc: ansic: 102; sh: 13; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#' @title Check if type string is of certain type.
#'
#' @description `TRUE` iff the type string is a certain type, e.g.
#' `isIntegerTypeString` checks if we have \dQuote{integer} or
#' \dQuote{integervector}, and `isVectorTypeString` check if we have
#' \dQuote{*vector}.
#'
#' @template arg_typestring
#' @template arg_include_int
#' @template arg_include_logical
#' @template ret_bool
#' @name isTypeString
#' @rdname isTypeString
NULL

#' @export
#' @rdname isTypeString
isNumericTypeString = function(type, include.int = TRUE) {
  type %fin% getTypeStringsNumeric(include.int)
}

#' @export
#' @rdname isTypeString
isIntegerTypeString = function(type) {
  type %fin% getTypeStringsInteger()
}

#' @export
#' @rdname isTypeString
isCharacterTypeString = function(type) {
  type %fin% getTypeStringsCharacter()
}

#' @export
#' @rdname isTypeString
isDiscreteTypeString = function(type, include.logical = TRUE) {
  type %fin% getTypeStringsDiscrete(include.logical)
}

#' @export
#' @rdname isTypeString
isLogicalTypeString = function(type) {
  type %fin% getTypeStringsLogical()
}

#' @export
#' @rdname isTypeString
isVectorTypeString = function(type) {
  endsWith(type, "vector")
}