home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-M / help / base / missing < prev    next >
Encoding:
Text File  |  1997-04-23  |  778 b   |  25 lines

  1.     
  2.     _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?
  3.     
  4.          missing(x)
  5.     
  6.     _D_e_s_c_r_i_p_t_i_o_n:
  7.     
  8.          missing can be used to test whether a value was speci-
  9.          fied as an argument to a function.  The following exam-
  10.          ple shows how a plotting function can be written to
  11.          work with either a pair of vectors giving x and y coor-
  12.          dinates of points to be plotted or a single vector giv-
  13.          ing y values to be plotted against their indexes.
  14.     
  15.     _E_x_a_m_p_l_e_s:
  16.     
  17.          myplot <- function(x,y) {
  18.                          if(missing(y)) {
  19.                                  y <- x
  20.                                  x <- 1:length(y)
  21.                          }
  22.                          plot(x,y)
  23.                  }
  24.     
  25.