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'

