median                 package:stats                 R Documentation

_M_e_d_i_a_n _V_a_l_u_e

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

     Compute the sample median.

_U_s_a_g_e:

     median(x, na.rm = FALSE)

_A_r_g_u_m_e_n_t_s:

       x: an object for which a method has been defined, or a numeric
          vector containing the values whose median is to be computed.

   na.rm: a logical value indicating whether 'NA' values should be
          stripped before the computation proceeds.

_D_e_t_a_i_l_s:

     This is a generic function for which methods can be written. 
     However, the default method makes use of 'sort' and 'mean', both
     of which are generic, and so the default method will work for most
     classes (e.g. '"Date"') for which a median is a reasonable
     concept.

_V_a_l_u_e:

     The default method returns a length-one object of the same type as
     'x', except when 'x' is integer of even length, when the result
     will be double.

     If there are no values or if 'na.rm = FALSE' and there are 'NA'
     values the result is 'NA' of the same type as 'x' (or more
     generally the result of 'x[FALSE][NA]').

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

     'quantile' for general quantiles.

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

     median(1:4)# = 2.5 [even number]
     median(c(1:3,100,1000))# = 3 [odd, robust]

