Description Usage Arguments Details Value See Also Examples

Vectors of storage type “integer” and “double” count as “numeric”, c.f. `is.numeric`

.
To explicitly check for real integer or double vectors, see `checkInteger`

, `checkIntegerish`

or
`checkDouble`

.

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 | ```
checkNumeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE)
check_numeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE)
assertNumeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL)
assert_numeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL)
testNumeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE)
test_numeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE)
expect_numeric(x, lower = -Inf, upper = Inf, finite = FALSE,
any.missing = TRUE, all.missing = TRUE, len = NULL,
min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE,
names = NULL, null.ok = FALSE, info = NULL, label = vname(x))
``` |

`x` |
[any] |

`lower` |
[ |

`upper` |
[ |

`finite` |
[ |

`any.missing` |
[ |

`all.missing` |
[ |

`len` |
[ |

`min.len` |
[ |

`max.len` |
[ |

`unique` |
[ |

`sorted` |
[ |

`names` |
[ |

`null.ok` |
[ |

`.var.name` |
[ |

`add` |
[ |

`info` |
[character(1)] |

`label` |
[ |

This function does not distinguish between
`NA`

, `NA_integer_`

, `NA_real_`

, `NA_complex_`

`NA_character_`

and `NaN`

.

Depending on the function prefix:
If the check is successful, the functions
`assertNumeric`

/`assert_numeric`

return
`x`

invisibly, whereas
`checkNumeric`

/`check_numeric`

and
`testNumeric`

/`test_numeric`

return
`TRUE`

.
If the check is not successful,
`assertNumeric`

/`assert_numeric`

throws an error message,
`testNumeric`

/`test_numeric`

returns `FALSE`

,
and `checkNumeric`

returns a string with the error message.
The function `expect_numeric`

always returns an
`expectation`

.

Other basetypes: `checkArray`

,
`checkAtomicVector`

,
`checkAtomic`

, `checkCharacter`

,
`checkComplex`

, `checkDataFrame`

,
`checkDate`

, `checkDouble`

,
`checkEnvironment`

,
`checkFactor`

, `checkFormula`

,
`checkFunction`

,
`checkIntegerish`

,
`checkInteger`

, `checkList`

,
`checkLogical`

, `checkMatrix`

,
`checkNull`

, `checkPOSIXct`

,
`checkRaw`

, `checkVector`

1 2 | ```
testNumeric(1)
testNumeric(1, min.len = 1, lower = 0)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.