Easy integration of (small) tables into (error) messages
print_and_capture.rd
Some (error) messages are more understandable if small (frequency)
tables are used for clearness. The function simplifies integration of these tables.
The function is intended to be used in combination with message
,
stop
, or cat
, for example.
Examples
frequency.table <- as.table(matrix(c(12,0,5,7),2,2))
attr(frequency.table, "dimnames") <- list("sex" = c("male", "female"),
"migration" = c(TRUE, FALSE))
message("Some combinations of variables with zero observations: \n",
print_and_capture(frequency.table, spaces = 5))
#> Some combinations of variables with zero observations:
#> migration
#> sex TRUE FALSE
#> male 12 5
#> female 0 7