Catapult Class for Consistent Printing
catapult.RdCreates an object of class "catapult" with a built-in title string used for printing.
Arguments
- object
Object to be converted to
"catapult"class.- lead
a
characterstring giving the title to be printed.- revert
logicalindicating whether the"revert"attribute should be set toTRUEorFALSE. By default, whenFALSE, the corresponding print methodprint.catapult()will invoke further print methods for the underlying inheritedobject; ifTRUE,print.catapult()will return to the calling function after printinglead.- ...
additional named arguments to be forwarded to print methods of classes inherited from
object, for example as required for formatting and printing adata frame.- x
an object used to select a method.
Examples
catapult()
#> ___________
#> Catapult: -
#>
#> logical(0)
(cpt <- catapult("x", lead = "Lorem ipsum dolor sit amet"))
#> _____________________________
#> Lorem ipsum dolor sit amet: -
#>
#> [1] "x"
.class2(cpt)
#> [1] "catapult" "character"
attr(cpt, "revert")
#> [1] FALSE
(cpt <- catapult("x", lead = "Lorem ipsum dolor sit amet", TRUE))
#> _____________________________
#> Lorem ipsum dolor sit amet: -
#>
.class2(cpt)
#> [1] "catapult" "character"
attr(cpt, "revert")
#> [1] TRUE
rm(cpt)