missing package: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 specified as an argument to a function. _U_s_a_g_e: missing(x) _A_r_g_u_m_e_n_t_s: x: a formal argument. _D_e_t_a_i_l_s: 'missing(x)' is only reliable if 'x' has not been altered since entering the function: in particular it will _always_ be false after 'x <- match.arg(x)'. The example shows how a plotting function can be written to work with either a pair of vectors giving x and y coordinates of points to be plotted or a single vector giving y values to be plotted against their indexes. Currently 'missing' can only be used in the immediate body of the function that defines the argument, not in the body of a nested function or a 'local' call. This may change in the future. This is a primitive function. _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. Chambers, J. M. (1998) _Programming with Data. A Guide to the S Language_. Springer. _S_e_e _A_l_s_o: 'substitute' for argument expression; 'NA' for missing 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) }