Ranges-comparison          package:IRanges          R Documentation

_R_a_n_g_e_s _c_o_m_p_a_r_i_s_o_n

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

     Equality and ordering of ranges, and related methods.

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

       ## ==== Equality and related methods ====
       ## --------------------------------------

       x == y
       x != y

       ## S4 method for signature 'Ranges':
       duplicated(x, incomparables=FALSE, fromLast=FALSE, ...)

       ## S4 method for signature 'Ranges':
       unique(x, incomparables=FALSE, fromLast=FALSE, ...)

       ## ==== Ordering and related methods ====
       ## --------------------------------------

       x <= y
       x >= y
       x < y
       x > y

       ## S4 method for signature 'Ranges':
       order(..., na.last=TRUE, decreasing=FALSE)

       ## S4 method for signature 'Ranges':
       sort(x, decreasing=FALSE, ...)

       ## S4 method for signature 'Ranges':
       rank(x, na.last=TRUE, ties.method=c("average", "first", "random", "max", "min"))

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

     x,y: A Ranges object. 

incomparables: Must be 'FALSE'. 

fromLast: 'TRUE' or 'FALSE'. 

     ...: Ranges objects for 'order'. 

 na.last: Ignored. 

decreasing: 'TRUE' or 'FALSE'. 

ties.method: A character string specifying how ties are treated. Only
          '"first"' is supported for now. 

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

     Two ranges are considered equal iff they share the same start and
     width. Note that with this definition, 2 empty ranges are
     generally not equal (they need to share the same start to be
     considered equal).

     Ranges are ordered by starting position first, and then by width.
     This way, the space of ranges is totally ordered. The 'order',
     'sort' and 'rank' methods for Ranges objects are consistent with
     this order.


      'duplicated(x)': Determines which elements of 'x' are equal to
          elements with smaller subscripts, and returns a logical
          vector indicating which elements are duplicates. It is
          semantically equivalent to 'duplicated(as.data.frame(x))'.
          See 'duplicated' in the base package for more details.

      'unique(x)': Removes duplicate ranges from 'x'. See 'unique' in
          the base package for more details.

      'order(...)': Returns a permutation which rearranges its first
          argument (a Ranges object) into ascending order, breaking
          ties by further arguments (also Ranges objects). See 'order'
          in the base package for more details.

      'sort(x)': Sorts 'x'. See 'sort' in the base package for more
          details.

      'rank(x, na.last=TRUE, ties.method=c("average", "first",
          "random", "max", "min"))': Returns the sample ranks of the
          ranges in 'x'. See 'rank' in the base package for more
          details.


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

     Ranges-class, IRanges-class, 'duplicated', 'unique', 'order',
     'sort', 'rank'

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

       x <- IRanges(start=c(20L, 8L, 20L, 22L, 25L, 20L, 22L, 22L),
                    width=c( 4L, 0L, 11L,  5L,  0L,  9L,  5L,  0L))
       x
       which(width(x) == 0)  # 3 empty ranges
       x[2] == x[5]  # FALSE
       x == x[4]
       duplicated(x)
       unique(x)
       x >= x[3]
       order(x)
       sort(x)
       rank(x, ties.method="first")

