Prints a matrix where .
means cell matches, X
means cell does
cells do not match, +
cell (row) is missing, and -
cell (row)
should not be there. If structure
is set to TRUE
, C
indicates
columnar structure mismatch, R
indicates row-structure mismatch, and
S
indicates mismatch in both row and column structure.
compare_rtables(
object,
expected,
tol = 0.1,
comp.attr = TRUE,
structure = FALSE
)
rtable to test
rtable expected
numerical tolorance
boolean. Compare format of cells. Other attributes are silently ignored.
boolean. Should structure (in the form of column and row paths to cells) be compared. Currently defaults to FALSE
, but this is subject to change in future versions.
a matrix of class "rtables_diff"
representing the differences
between object
and expected
as described above.
# NOT RUN {
t1 <- rtable(header = c("A", "B"), format = "xx", rrow("row 1", 1, 2))
t2 <- rtable(header = c("A", "B", "C"), format = "xx", rrow("row 1", 1, 2, 3))
compare_rtables(object = t1, expected = t2)
if(interactive()){
Viewer(t1, t2)
}
expected <- rtable(
header = c("ARM A\nN=100", "ARM B\nN=200"),
format = "xx",
rrow("row 1", 10, 15),
rrow(),
rrow("section title"),
rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)"))
)
expected
object <- rtable(
header = c("ARM A\nN=100", "ARM B\nN=200"),
format = "xx",
rrow("row 1", 10, 15),
rrow("section title"),
rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)"))
)
compare_rtables(object, expected, comp.attr = FALSE)
object <- rtable(
header = c("ARM A\nN=100", "ARM B\nN=200"),
format = "xx",
rrow("row 1", 10, 15),
rrow(),
rrow("section title")
)
compare_rtables(object, expected)
object <- rtable(
header = c("ARM A\nN=100", "ARM B\nN=200"),
format = "xx",
rrow("row 1", 14, 15.03),
rrow(),
rrow("section title"),
rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)"))
)
compare_rtables(object, expected)
object <- rtable(
header = c("ARM A\nN=100", "ARM B\nN=200"),
format = "xx",
rrow("row 1", 10, 15),
rrow(),
rrow("section title"),
rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.x, xx.x)"))
)
compare_rtables(object, expected)
# }
Run the code above in your browser using DataLab