I have a routine that returns a data frame. I want to check if its values are reasonable. Using testthat
I have expect_equal
, but I am not sure if it applies to data.frames. I tried to do this but it doesn't work
testthat::expect_equal(result$ORs[1,1:3], c(1.114308, 0.5406599, 2.296604), tolerance=1.0e-6)
This is the message I get
─────────────────────────────────────────────────
test-xxx.R:19: failure: basic functionality
result$ORs[1, 1:3] not equal to c(1.114308, 0.5406599, 2.296604).
Modes: list, numeric
names for target but not for current
Attributes: < Modes: list, NULL >
Attributes: < Lengths: 2, 0 >
Attributes: < names for target but not for current >
Attributes: < current is not list-like >
─────────────────────────────────────────────────
══ Results ══════════════════════════════════════
Duration: 0.1 s
compare
andall.equal
seems to work. – Neritic