Print out a comparison
print_comparison.Rd
Converts objects to a data.table
object and prints it out
Details
The object provided is printed out as if it were data.table
object without
explicitly converting it. As such, this function returns a data.table
object, not a comparison
.
This function was written to avoid potential errors, as
using the generic print function on a comparison
object can cause an error
if the print.comparison
method from the testthat
package is loaded.
Outside of this situation, printing out a comparison
object as normal
should function properly.
Examples
## Get some values
starts1 <- c(2, 1000, 1050)
ends1 <- c(600, 800, 1345)
starts2 <- c(50, 800, 1200)
ends2 <- c(900, 1100, 1322)
## From a data.frame
comparison1 <- as.comparison(data.frame(start1 = starts1, end1 = ends1,
start2 = starts2, end2 = ends2))
print_comparison(comparison1)
#> start1 end1 start2 end2 direction
#> <num> <num> <num> <num> <num>
#> 1: 2 600 50 900 1
#> 2: 1000 800 800 1100 -1
#> 3: 1050 1345 1200 1322 1
## Printing out a comparison like this can occasionally throw an error:
if (FALSE) { # \dontrun{
comparison1
print(comparison1)} # }
## This can happen when print.comparison is loaded from the testthat package
## To avoid this, use print_comparison as shown above