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' and its 'print' method print the 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 description of 'options("warn")' for the circumstances
     under which there is a 'last.warning' object 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 and not to the last warning, for example if
     'options(warn)' has been changed or if a catastrophic error
     occurred.

_W_a_r_n_i_n_g:

     It is undocumented where 'last.warning' is stored nor that it is
     visible, and this is subject to change.  Prior to R 2.4.0 it was
     stored in the workspace, but no longer.

_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

