

   rle {base}                                   R Documentation

   RRuunn LLeennggtthh EEnnccooddiinngg

   DDeessccrriippttiioonn::

        Compute the lengths and values of runs of equal values
        in a vector.

   UUssaaggee::

        rle(x)

   AArrgguummeennttss::

          x: a vector.

   VVaalluuee::

        A list with components

    lengths: a vector containing the length of each run.

     values: a vector of the same length as `lengths' with the
             corresponding values.

   EExxaammpplleess::

        x <- rev(rep(6:10, 1:5))
        rle(x)
        ## $lengths
        ## [1] 5 4 3 2 1
        ## $values
        ## [1] 10  9  8  7  6

