rev                   package:base                   R Documentation

_R_e_v_e_r_s_e _E_l_e_m_e_n_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     'rev' provides a reversed version of its argument.  It is generic
     function with a default method for vectors and one for
     'dendrogram's.

     Note that this is no longer needed (nor efficient) for obtaining
     vectors sorted into descending order, since that is now rather
     more directly achievable by 'sort(x, decreasing = TRUE)'.

_U_s_a_g_e:

     rev(x)

_A_r_g_u_m_e_n_t_s:

       x: a vector or another object for which reversal is defined.

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

     'seq', 'sort'.

_E_x_a_m_p_l_e_s:

     x <- c(1:5,5:3)
     ## sort into descending order; first more efficiently:
     stopifnot(sort(x, decreasing = TRUE) == rev(sort(x)))
     stopifnot(rev(1:7) == 7:1)#- don't need 'rev' here

