Sys.sleep                package:base                R Documentation

_S_u_s_p_e_n_d _E_x_e_c_u_t_i_o_n _f_o_r _a _T_i_m_e _I_n_t_e_r_v_a_l

_D_e_s_c_r_i_p_t_i_o_n:

     Suspend execution of R expressions for a given number of seconds

_U_s_a_g_e:

     Sys.sleep(time)

_A_r_g_u_m_e_n_t_s:

    time: The time interval to suspend execution for, in seconds.

_D_e_t_a_i_l_s:

     Using this function allows R to be given very low priority and
     hence not to interfere with more important foreground tasks. A
     typical use is to allow a process launched from R to set itself up
     and read its input files before R execution is resumed.

     The intention is that this function suspends execution of R
     expressions but wakes the process up often enough to respond to
     GUI events, typically every 0.5 seconds.

     There is no guarantee that the process will sleep for the whole of
     the specified interval, and it may well take slightly longer in
     real time to resume execution.  The resolution of the time
     interval is system-dependent, but will normally be down to 0.02
     secs or better. (On modern Unix-alikes it will be better than
     1ms.)

_V_a_l_u_e:

     Invisible 'NULL'.

_N_o_t_e:

     This function may not be implemented on all systems.

_E_x_a_m_p_l_e_s:

     testit <- function(x)
     {
         p1 <- proc.time()
         Sys.sleep(x)
         proc.time() - p1 # The cpu usage should be negligible
     }
     testit(3.7)

