AtomicList              package:IRanges              R Documentation

_L_i_s_t_s _o_f _A_t_o_m_i_c _V_e_c_t_o_r_s _i_n _N_a_t_u_r_a_l _a_n_d _R_l_e _F_o_r_m

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

     An extension of 'TypedList' that holds only atomic vectors in
     either a natural or run-length encoded form.

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

     The lists of atomic vectors are 'LogicalList', 'IntegerList',
     'NumericList', 'ComplexList', 'CharacterList', and 'RawList'.
     There is also an 'RleList' class for run-length encoded versions
     of these atomic vector types.

_C_o_n_s_t_r_u_c_t_o_r_s:


      'LogicalList(..., compress = TRUE)': Concatenates the 'logical'
          vectors in '...' into a new 'LogicalList'. If 'compress', the
          internal storage of the data is compressed.

      'IntegerList(..., compress = TRUE)': Concatenates the 'integer'
          vectors in '...' into a new 'IntegerList'. If 'compress', the
          internal storage of the data is compressed.

      'NumericList(..., compress = TRUE)': Concatenates the 'numeric'
          vectors in '...' into a new 'NumericList'. If 'compress', the
          internal storage of the data is compressed.

      'ComplexList(..., compress = TRUE)': Concatenates the 'complex'
          vectors in '...' into a new 'ComplexList'. If 'compress', the
          internal storage of the data is compressed.

      'CharacterList(..., compress = TRUE)': Concatenates the
          'character' vectors in '...' into a new 'CharacterList'. If
          'compress', the internal storage of the data is compressed.

      'RawList(..., compress = TRUE)': Concatenates the 'raw' vectors
          in '...' into a new 'RawList'. If 'compress', the internal
          storage of the data is compressed.

      'RleList(..., compress = TRUE)': Concatenates the run-length
          encoded atomic vectors in '...' into a new 'RleList'. If
          'compress', the internal storage of the data is compressed.

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

     P. Aboyoun

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

     'TypedList' for the applicable methods.

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

       int1 <- c(1L,2L,3L,5L,2L,8L)
       int2 <- c(15L,45L,20L,1L,15L,100L,80L,5L)
       collection <- IntegerList(int1, int2)

       ## names
       names(collection) <- c("one", "two")
       names(collection)
       names(collection) <- NULL # clear names
       names(collection)
       names(collection) <- "one"
       names(collection) # c("one", NA)

       ## extraction
       collection[[1]] # range1
       collection[["1"]] # NULL, does not exist
       collection[["one"]] # range1
       collection[[NA_integer_]] # NULL

       ## subsetting
       collection[numeric()] # empty
       collection[NULL] # empty
       collection[] # identity
       collection[c(TRUE, FALSE)] # first element
       collection[2] # second element
       collection[c(2,1)] # reversed
       collection[-1] # drop first
       collection$one

       ## replacement
       collection$one <- int2
       collection[[2]] <- int1

       ## combining
       col1 <- IntegerList(one = int1, int2)
       col2 <- IntegerList(two = int2, one = int1)
       col3 <- IntegerList(int2)
       append(col1, col2)
       append(col1, col2, 0)
       c(col1, col2, col3)

       ## get the mean for each element
       lapply(col1, mean)

