sort                  package:base                  R Documentation

_S_o_r_t _a _V_e_c_t_o_r

_D_e_s_c_r_i_p_t_i_o_n:

     Sort a numeric or complex vector (partially) into ascending order.

_U_s_a_g_e:

     sort(x, partial = NULL, na.last = NA)

_A_r_g_u_m_e_n_t_s:

       x: a numeric or complex vector.

 partial: a vector of indices for partial sorting.

 na.last: for controlling the treatment of `NA's. If `TRUE', missing
          values in the data are put last; if `FALSE', they are put
          first; if `NA', they are removed.

_D_e_t_a_i_l_s:

     If `partial' is non `NULL', it is taken to contain indexes of
     elements of `x' which are to be placed in their correct positions
     by partial sorting.  After the sort, the values specified in
     `partial' are in their correct position in the sorted array.  Any
     values smaller than these values are guaranteed to have a smaller
     index in the sorted array and any values which are greater are
     guaranteed to have a bigger index in the sorted array.

_S_e_e _A_l_s_o:

     `order', `rank'.

_E_x_a_m_p_l_e_s:

     data(swiss)
     x <- swiss$Education[1:25]
     x; sort(x); sort(x, partial = c(10, 15))
     median # shows you another example for `partial'

