sequence                package:base                R Documentation

_C_r_e_a_t_e _A _V_e_c_t_o_r _o_f _S_e_q_u_e_n_c_e_s

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

     For each element of 'nvec' the sequence 'seq_len(nvec[i])' is
     created.  These are concatenated and the result returned.

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

     sequence(nvec)

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

    nvec: a non-negative integer vector each element of which specifies
          the end point of a sequence.

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

     Earlier versions of 'sequence' used to work for 0 or negative
     inputs as 'seq(x) == 1:x'.

     Note that 'sequence <- function(nvec) unlist(lapply(nvec,
     seq_len))' and it mainly exists in reverence to the very early
     history of R.

_S_e_e _A_l_s_o:

     'gl', 'seq', 'rep'.

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

     sequence(c(3,2))# the concatenated sequences 1:3 and 1:2.
     #> [1] 1 2 3 1 2

