warnings                package:base                R Documentation

_P_r_i_n_t _W_a_r_n_i_n_g _M_e_s_s_a_g_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'warnings' prints the top-level variable 'last.warning' in a
     pleasing form.

_U_s_a_g_e:

     warnings(...)

_A_r_g_u_m_e_n_t_s:

     ...: arguments to be passed to 'cat'.

_D_e_t_a_i_l_s:

     See the decription of 'options("warn")' for the circumstances
     under which there is a 'last.warning' variable and 'warnings()' is
     used.  In essence this is if 'options(warn = 0)' and 'warning' has
     been called at least once.

     It is possible that 'last.warning' refers to the last recorded
     warning (possibly even in a previous session with a saved
     workspace), and not to the last warning, for example if
     'options(warn)' has been changed or if a catastrophic error
     occurred.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'warning'.

_E_x_a_m_p_l_e_s:

     ## NB this example is intended to be pasted in,
     ##    rather than run by example()
     ow <- options("warn")
     for(w in -1:1) {
        options(warn = w); cat("\n warn =",w,"\n")
        for(i in 1:3) { cat(i,"..\n"); m <- matrix(1:7, 3,4) }
     }
     warnings()
     options(ow) # reset

