assert: Assertions

Description Usage Arguments Examples

Description

Usage

 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

Arguments

x

Usually a vector.

f

A function.

args.name

Vector of (argument) names to check.

...

Objects to check.

strict

Whether to check for strict positivity? Default is TRUE.

class

Class to check.

value

Value to check.

dir.path

Directory to check.

file

File to check.

ext

Extension to check (without the dot at the beginning).

type

Type to check.

pkg

Name of a package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
assert_nona(1:3)
assert_args(assert_nona, "x")
assert_lengths(1:3, 4:6, as.list(1:3))
assert_int(c(1, 2, 3))
assert_01(c(0, 1, 0))
assert_multiple(1:3)
assert_class(assert_nona, "function")
assert_all(1:3 > 0)
assert_all(rep(0, 3), 0)
assert_dir(tempdir())
assert_noexist(tmp <- tempfile())
write("test", tmp)
assert_exist(tmp)
assert_ext("test.txt", "txt")
assert_type(1:3, "integer")
assert_sorted(1:3)
assert_package("stats")

test <- function(...) {
  assert_nodots()
  NULL
}
test()

bigassertr documentation built on July 9, 2021, 1:06 a.m.