ProgressBarText-class package:affy R Documentation _C_l_a_s_s "_P_r_o_g_r_e_s_s_B_a_r_T_e_x_t" _D_e_s_c_r_i_p_t_i_o_n: A class to handle progress bars in text mode _O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s: Objects can be created by calls of the form 'new("ProgressBarText", steps)'. _S_l_o_t_s: '_s_t_e_p_s': Object of class '"integer"'. The total number of steps the progress bar should represent '_b_a_r_s_t_e_p_s': Object of class '"integer"'. The size of the progress bar. '_i_n_t_e_r_n_a_l_s': Object of class '"environment"'. For internal use. _M_e_t_h_o_d_s: _c_l_o_s_e 'signature(con = "ProgressBarText")': Terminate the progress bar (i.e. print what needs to be printed). Note that closing the instance will ensure the progress bar is plotted to its end. _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "ProgressBarText")': initialize a instance. _o_p_e_n 'signature(con = "ProgressBarText")': Open a progress bar (i.e. print things). In the case open is called on a progress bar that was 'progress', the progress bar is resumed (this might be useful when one wishes to insert text output while there is a progress bar running). _u_p_d_a_t_e 'signature(object = "ProgressBarText")': Update the progress bar (see examples). _A_u_t_h_o_r(_s): Laurent _E_x_a_m_p_l_e_s: f <- function(x, header = TRUE) { pbt <- new("ProgressBarText", length(x), barsteps = as.integer(20)) open(pbt, header = header) for (i in x) { Sys.sleep(i) update(pbt) } close(pbt) } ## if too fast on your machine, change the number x <- runif(15) f(x) f(x, header = FALSE) ## 'cost' of the progress bar: g <- function(x) { z <- 1 for (i in 1:x) { z <- z + 1 } } h <- function(x) { pbt <- new("ProgressBarText", as.integer(x), barsteps = as.integer(20)) open(pbt) for (i in 1:x) { update(pbt) } close(pbt) } system.time(g(10000)) system.time(h(10000))