my.prn
my.prn <-
function (x, txt)
{
calltext <- as.character(sys.call())[2]
if (!missing(txt)) {
if (nchar(txt) + nchar(calltext) + 3 > .Options$width)
calltext <- paste("\n\n ", calltext, sep = "")
else txt <- paste(txt, " ", sep = "")
cat("\n", txt,"\n> " ,calltext, "\n\n", sep = "")
}
else cat("\n> ", calltext, "\n\n", sep = "")
invisible(print(x))
}
#' @examples
my.prn(1:5)
##
## > 1:5
##
## [1] 1 2 3 4 5
my.prn(1:5,"This is a sequence of first five integers")
##
## This is a sequence of first five integers
## > 1:5
##
## [1] 1 2 3 4 5
my.prn(exists("bla"),"You can check, if object named bla exists")
##
## You can check, if object named bla exists
## > exists("bla")
##
## [1] FALSE