Skip to content

Commit

Permalink
docs: R numeric snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
niekdt committed Sep 9, 2024
1 parent cf2449e commit 695a048
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/actionsheets/data/R/basic/numeric.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ details = "Integers are also numeric"
action = "Is numeric, but not integer"
code = "storage.mode(x) == 'double'"

[test.scalar]
section = "Tests for single number(s)"

[test.scalar.equal]
action = "Is equal to number"
code = "isTRUE(all.equal(x, y))"

[test.scalar.equal.2]
code = "abs(x - y) < .Machine$double.eps"

[test.scalar.equal.tol]
action = "Is equal to number with tolerance _t_"
code = "isTRUE(all.equal(x, y, tolerance = t))"

[test.scalar.equal.tol.2]
code = "abs(x - y) < t"

[test.vector]
section = "Tests for vector"
Expand All @@ -91,6 +107,14 @@ code = "abs(max(x) - min(x)) < .Machine$double.neg.eps"
action = "All elements are equal within absolute tolerance _t_ (no `NA`s present)"
code = "abs(max(x) - min(x)) < t"

[test.vector.equal.all.na]
action = "All elements are equal (with NAs)"
code = "isTRUE(all.equal(x, y))"

[test.vector.equal.tol.na]
action = "All elements are equal within absolute tolerance _t_"
code = "isTRUE(all.equal(x, y, tolerance = t))"


[derive]
section = "Derive"
Expand Down

0 comments on commit 695a048

Please sign in to comment.