1 2# This R package is free software; you can redistribute it and/or 3# modify it under the terms of the GNU Library General Public 4# License as published by the Free Software Foundation; either 5# version 2 of the License, or (at your option) any later version. 6# 7# This R package is distributed in the hope that it will be useful, 8# but WITHOUT ANY WARRANTY; without even the implied warranty of 9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# GNU Library General Public License for more details. 11# 12# You should have received a copy of the GNU Library General 13# Public License along with this R package; if not, write to the 14# Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15# MA 02111-1307 USA 16 17 18################################################################################ 19# FUNCTION: DESCRIPTION: 20# show.timeDate Prints 'timeDate' object 21################################################################################ 22 23# ---------------------------------------------------------------------------- # 24# Roxygen Tags 25#' @export 26# ---------------------------------------------------------------------------- # 27setMethod("show", "timeDate", function (object) 28{ 29 # A function implemented by Yohan Chalabi and Diethelm Wuertz 30 31 # when creating empty new("timeDate") 32 if (!length(slot(object, "Data"))) 33 return(str(object)) 34 35 # Check records to get printed: 36 maxRmetrics <- as.numeric(getRmetricsOptions("max.print")) 37 maxR <- as.numeric(getOption("max.print")) 38 max <- min(na.omit(c(maxRmetrics, maxR, Inf))) 39 #-> Inf to cast case when maxRmetrics and maxR are NULL 40 41 if (ptest <- ((omitted <- length(object) - max) > 0)) 42 object <- object[seq.int(max)] 43 44 output <- format(object) 45 layout <- paste0("[", output, "]") 46 names(layout) <- names(output) 47 48 # Print Results: 49 cat(finCenter(object), "\n", sep = "") 50 print(layout, quote = FALSE) 51 52 # print message 53 if (ptest) 54 cat(gettextf("...\n [ reached getRmetricsOption('max.print') | getOption('max.print') -- omitted %i rows ]]\n", omitted)) 55 56 # Return Value: 57 invisible(NULL) # 'show' returns an invisible 'NULL'. (cf. ?show) 58}) 59 60 61################################################################################ 62