Views-utils             package:IRanges             R Documentation

_U_t_i_l_i_t_y _f_u_n_c_t_i_o_n_s _a_n_d _n_u_m_e_r_i_c _s_u_m_m_a_r_y _o_f _V_i_e_w_s _o_f _n_u_m_e_r_i_c_s

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

     The 'slice' function creates a Views object that contains the
     indices where the data are within the specified bounds.

     The 'viewMins', 'viewMaxs', 'viewSums' functions calculate the
     minimums, maximums, and sums on views respectively.

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

       viewApply(X, FUN, ..., simplify = TRUE)

       slice(x, lower=-Inf, upper=Inf, ...)
       ## S4 method for signature 'Rle':
       slice(x, lower=-Inf, upper=Inf,
                             includeLower=TRUE, includeUpper=TRUE)

       viewMins(x, na.rm=FALSE)
       viewMaxs(x, na.rm=FALSE)
       viewSums(x, na.rm=FALSE)

       viewWhichMins(x, na.rm=FALSE)
       viewWhichMaxs(x, na.rm=FALSE)

       viewRangeMins(x, ...)
       viewRangeMaxs(x, ...)

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

       X: A Views object. 

     FUN: The function to be applied to each view in 'X'. 

     ...: Additional arguments to be passed on. 

simplify: A logical value specifying whether or not the result should
          be simplified to a vector or matrix if possible. 

       x: An Rle, XRleInteger, XInteger object or an integer vector for
          'slice'.

          An RleViews, XRleIntegerViews, XIntegerViews object for
          'viewMins', 'viewMaxs', and 'viewSums'.

          An Rle, XRleIntegerViews, XIntegerViews object for
          'viewWhichMins' and 'viewWhichMaxs'. 

lower, upper: The lower and upper bounds for the slice. 

includeLower, includeUpper: Logical indicating whether or not the
          specified boundary is open or closed. 

   na.rm: Logical indicating whether or not to include missing values
          in the results. 

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

     The 'slice' function creates views on XRleInteger or XInteger
     objects where the data are within the specified bounds. This is
     useful for finding areas of absolute maxima (peaks), absolute
     minima (troughs), or fluxuations within a specified limits.

     The 'viewMins', 'viewMaxs', and 'viewSums' functions provide
     efficient methods for calculating the specified numeric summary by
     performing the looping in compiled code.

     The 'viewWhichMins', 'viewWhichMaxs', 'viewRangeMins', and
     'viewRangeMaxs' functions provide efficient methods for finding
     the location of the minimums and maximums.

_V_a_l_u_e:

     An XRleIntegerViews or XIntegerViews object for 'slice'.

     A vector of 'length(x)' containing the numeric summaries for the
     views for 'viewMins', 'viewMaxs', 'viewSums', 'viewWhichMins', and
     'viewWhichMaxs'.

     A IRanges object containing the location ranges for
     'viewRangeMins' and 'viewRangeMaxs'.

_A_u_t_h_o_r(_s):

     P. Aboyoun

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

     RleViews-class, XRleIntegerViews-class, XIntegerViews-class,
     'which.min', 'colSums'

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

       ## Views derived from vector
       vec <- as.integer(c(19, 5, 0, 8, 5))
       slice(vec, lower=5, upper=8)

       set.seed(0)
       vec <- sample(24)
       vecViews <- slice(vec, lower=4, upper=16)
       vecViews
       viewApply(vecViews, function(x) diff(as.integer(x)))
       viewMins(vecViews)
       viewMaxs(vecViews)
       viewSums(vecViews)
       viewWhichMins(vecViews)
       viewWhichMaxs(vecViews)

       ## Views derived from coverage
       x <- IRanges(start=c(1L, 9L, 4L, 1L, 5L, 10L),
                    width=c(5L, 6L, 3L, 4L, 3L,  3L))
       slice(coverage(x), lower=2)

