DataTable-class           package:IRanges           R Documentation

DataTable objects

Description:

     The DataTable virtual class provides an interface for the storing
     rectangular data sets, like a basic data.frame object. It extends
     'Sequence'.

Accessors:

     In the following code snippets, 'x' is a 'DataTable'.

      'nrow(x)', 'ncol(x)': Get the number of rows and columns,
          respectively.

      'NROW(x)', 'NCOL(x)': Same as 'nrow(x)' and 'ncol(x)',
          respectively.

      'dim(x)': Length two integer vector defined as 'c(nrow(x),
          ncol(x))'.

      'rownames(x)', 'colnames(x)': Get the names of the rows and
          columns, respectively.

      'dimnames(x)': Length two list of character vectors defined as
          'list(rownames(x), colnames(x))'.


Subsetting:

     In the code snippets below, 'x' is a DataTable object.


      'x[i, j, drop=TRUE]': Return a new DataTable object made of the
          selected rows and columns. For single column selection, the
          'drop' argument specifies whether or not to coerce the
          returned sequence to a standard vector.

      'window(x, start = NA, end = NA, width = NA, frequency = NULL,
          delta = NULL, ...)': Extract the subsequence window from the
          DataTable object using:

          'start', 'end', 'width' The start, end, or width of the
               window. Two of the three are required.

          'frequency', 'delta' Optional arguments that specify the
               sampling frequency and increment within the window.

          In general, this is more efficient than using '"["' operator.

      'window(x, start = NA, end = NA, width = NA, keepLength = TRUE)
          <- value': Replace the subsequence window specified on the
          left (i.e. the subsequence in 'x' specified by 'start', 'end'
          and 'width') by 'value'. 'value' must either be of class
          'class(x)', belong to a subclass of 'class(x)', be coercible
          to 'class(x)', or be 'NULL'. If 'keepLength' is 'TRUE', the
          number of rows of 'value' are repeated to create a DataTable
          with the same number of rows as the width of the subsequence
          window it is replacing. If 'keepLength' is 'FALSE', this
          replacement method can modify the number of rows of 'x',
          depending on how the number of rows of the left subsequence
          window compares to the number of rows of 'value'.

      'seqselect(x, start=NULL, end=NULL, width=NULL)': Similar to
          'window', except that multiple subsequences can be requested.
          The requested subsequences are concatenated.

      'seqselect(x, start=NULL, end=NULL, width=NULL) <- value':
          Similar to 'window<-', except that multiple consecutive
          subsequences can be replaced by a 'value' that spans those
          windows.

      'head(x, n = 6L)': If 'n' is non-negative, returns the first n
          rows of the DataTable object. If 'n' is negative, returns all
          but the last 'abs(n)' rows of the DataTable object.

      'tail(x, n = 6L)': If 'n' is non-negative, returns the last n
          rows of the DataTable object. If 'n' is negative, returns all
          but the first 'abs(n)' rows of the DataTable object.

      'subset(x, subset, select, drop = FALSE)': Return a new DataTable
          object using:

          subset logical expression indicating rows to keep, where
               missing values are taken as FALSE.

          select expression indicating columns to keep.

          drop passed on to '[' indexing operator.


      'na.omit(object)': Returns a subset with incomplete cases
          removed.

      'na.exclude(object)': Returns a subset with incomplete cases
          removed (but to be included with NAs in statistical results).

      'is.na(x)': Returns a logical matrix indicating which cells are
          missing.

      'complete.cases(x)': Returns a logical vector identifying which
          cases have no missing values.


Combining:

     In the code snippets below, 'x' is a DataTable object.


      'cbind(...)': Creates a new 'DataTable' by combining the columns
          of the 'DataTable' objects in '...'.

      'rbind(...)': Creates a new 'DataTable' by combining the rows of
          the 'DataTable' objects in '...'.


Looping:

     In the code snippets below, 'x' is a DataTable object.


      'aggregate(x, by, FUN, start = NULL, end = NULL, width = NULL,
          frequency = NULL, delta = NULL, ..., simplify = TRUE))':
          Generates summaries on the specified windows and returns the
          result in a convenient form:

          'by' An object with 'start', 'end', and 'width' methods.

          'FUN' The function, found via 'match.fun', to be applied to
               each window of 'x'.

          'start', 'end', 'width' the start, end, or width of the
               window. If 'by' is missing, then must supply two of the
               three.

          'frequency', 'delta' Optional arguments that specify the
               sampling frequency and increment within the window.

          ... Further arguments for 'FUN'.

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


      'by(data, INDICES, FUN, ..., simplify = TRUE)': Apply 'FUN' to
          each group of 'data', a 'DataTable', formed by the factor (or
          list of factors) 'INDICES'. Exactly  the same contract as
          'as.data.frame'.


Coercion:


      'as.env(x, enclos = parent.frame())': Creates an environment from
          'x' with a symbol for each 'colnames(x)'. The values are not
          actually copied into the environment. Rather, they are
          dynamically bound using 'makeActiveBinding'. This prevents
          unnecessary copying of the data from the external vectors
          into R vectors. The values are cached, so that the data is
          not copied every time the symbol is accessed.


See Also:

     DataTable-stats for statistical functionality, like fitting
     regression models, DataFrame-class for an implementation that
     mimics 'data.frame', Sequence-class

Examples:

       showClass("DataTable")  # shows (some of) the known subclasses

