MultiVerbose             package:R.utils             R Documentation

_A _V_e_r_b_o_s_e _c_l_a_s_s _i_g_n_o_r_i_n_g _e_v_e_r_y_t_h_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     Package:  R.utils 
      *Class MultiVerbose*

     'Object'
      '~~|'
      '~~+--''Verbose'
      '~~~~~~~|'
      '~~~~~~~+--''MultiVerbose'

     *Directly known subclasses:*


     public static class *MultiVerbose*
      extends Verbose

     A Verbose class ignoring everything.

     _This is a trial class_.

_U_s_a_g_e:

     MultiVerbose(verboseList=NULL, ...)

_A_r_g_u_m_e_n_t_s:

verboseList: A 'list' of 'Verbose' objects.

     ...: Ignored.

_F_i_e_l_d_s _a_n_d _M_e_t_h_o_d_s:

     *Methods:*

         'lapply'    Applies a function to each of the Verbose objects.
         'writeRaw'  Writes to each of the Verbose objects.

     *Methods inherited from Verbose*:
      as.character, as.double, as.logical, capture, cat, enter, equals,
     evaluate, exit, getThreshold, getTimestampFormat, header, isOn,
     isVisible, less, more, newline, off, on, popState, print, printf,
     pushState, ruler, setDefaultLevel, setThreshold,
     setTimestampFormat, str, summary, timestamp, timestampOff,
     timestampOn, warnings, writeRaw

     *Methods inherited from Object*:
      $, $<-, [[, [[<-, as.character, attach, attachLocally,
     clearCache, clone, detach, equals, extend, finalize, gc,
     getEnvironment, getFields, getInstanciationTime,
     getStaticInstance, hasField, hashCode, ll, load, objectSize,
     print, save

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_E_x_a_m_p_l_e_s:

     # Output to both standard output and to log file
     stdoutLog <- Verbose(threshold=-1)
     fileLog <- Verbose("foo.log", threshold=-1)
     verbose <- MultiVerbose(list(stdoutLog, fileLog), threshold=-1)

     header(verbose, "A verbose writer example", padding=0)

     enter(verbose, "Analysis A")
     for (kk in 1:10) {
       printf(verbose, "step %d\n", kk)
       if (kk == 2) {
         cat(verbose, "Turning ON automatic timestamps")
         timestampOn(verbose);
       } else if (kk == 4) {
         timestampOff(verbose);
         cat(verbose, "Turned OFF automatic timestamps")
         cat(verbose, "Turning OFF verbose messages for steps ", kk, "-6")
         off(verbose)
       } else if (kk == 6) {
         on(verbose)
         cat(verbose, "Turned ON verbose messages just before step ", kk+1)
       }

       if (kk %in% c(5,8)) {
         enter(verbose, "Sub analysis ", kk)
         for (jj in c("i", "ii", "iii")) {
           cat(verbose, "part ", jj)
         }
         exit(verbose)
       }
     }
     cat(verbose, "All steps completed!")
     exit(verbose)

     ruler(verbose)
     cat(verbose, "Demo of some other methods:")
     str(verbose, c(a=1, b=2, c=3))
     print(verbose, c(a=1, b=2, c=3))
     summary(verbose, c(a=1, b=2, c=3))
     evaluate(verbose, rnorm, n=3, mean=2, sd=3)

     ruler(verbose)
     newline(verbose)

