R/print.convergence.clubs.R

Defines functions print.convergence.clubs

Documented in print.convergence.clubs

#'Print method for S3 object \code{convergence.clubs}
#'
#'
#'@param x an object of class \code{convergence.clubs}.
#'@param ... other parameters to pass to function \code{summary()}.
#'@export


print.convergence.clubs <- function(x, ...){

    what <-  ifelse( !is.null(attr(x, 'unit_names')), 'unit_names', 'id' )
    width <- round( 0.9*getOption('width'))

    for(item in names(x)){
        cat(strrep('=', width), '\n')
        cat(strsplit(item, "(?=[A-Za-z])(?<=[0-9])|(?=[0-9])(?<=[A-Za-z])", perl=TRUE)[[1]])
        cat('\n')
        cat(strrep('-', width), '\n')
        cat( strwrap(paste0(x[[item]][[what]], collapse=', '), width=width), fill=width)
        cat('\n')
        if( item != 'divergent'){
            beta    <- round(x[[item]][['model']]['beta'],4)
            std.err <- round(x[[item]][['model']]['std.err'],4)
            tvalue  <- round(x[[item]][['model']]['tvalue'],4)
            pvalue  <- round(x[[item]][['model']]['pvalue'],4)
            try(cstar   <- round(x[[item]][['cstar']],4), silent=TRUE)
            cat('beta:    ', paste0(ifelse(beta<0, '', ' '), beta, collapse=''), '\n')
            cat('std.err:  ',  std.err, '\n')
            cat('tvalue:  ', paste0(ifelse(tvalue<0, '', ' '), tvalue, collapse=''), '\n')
            cat('pvalue:   ', pvalue, '\n')
            try(cat('cstar:    ', cstar, '\n'), silent=TRUE)
            cat('\n')
        }
    }
}

Try the ConvergenceClubs package in your browser

Any scripts or data that you put into this service are public.

ConvergenceClubs documentation built on June 14, 2022, 1:06 a.m.