

missing {base}                               R Documentation

_D_o_e_s _a _F_o_r_m_a_l _A_r_g_u_m_e_n_t _h_a_v_e _a _V_a_l_u_e_?

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

     `missing' can be used to test whether a value was spec-
     ified as an argument to a function.  The following
     example shows how a plotting function can be written to
     work with either a pair of vectors giving x and y coor-
     dinates of points to be plotted or a single vector giv-
     ing y values to be plotted against their indexes.

_U_s_a_g_e_:

     missing(x)

_S_e_e _A_l_s_o_:

     `substitute' for argument expression; `NA' for ``miss-
     ing values'' in data.

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

     myplot <- function(x,y) {
                     if(missing(y)) {
                             y <- x
                             x <- 1:length(y)
                     }
                     plot(x,y)
             }

