data.frame               package:base               R Documentation

_D_a_t_a _F_r_a_m_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions create or manipulate data frames, tightly coupled
     collections of variables which share many of the properties of
     matrices and of lists, used as the fundamental data structure by
     most of R's modeling software.

_U_s_a_g_e:

     data.frame(..., row.names = NULL, check.rows = FALSE,
             check.names = TRUE)

     as.data.frame(x)
     is.data.frame(x)

     row.names(data.frame.obj)
     row.names(data.frame.obj) <- names
     print(data.frame.obj, ..., digits = NULL, quote = FALSE, right = TRUE)
     plot (data.frame.obj, ...)

_A_r_g_u_m_e_n_t_s:

     ...: these arguments are of either the form `value' or
          `tag=value'.  Component names are created based on the tag
          (if present) or the deparsed argument itself.

row.names: a character vector giving the row names for the data frame.

check.rows: if `TRUE' then the rows are checked for consistency of
          length and names.

check.names: if `TRUE' then the names of the variables in the data
          frame are checked to ensure that they are valid variable
          names.  If necessary they are adjusted (by `make.names') so
          that they are.

data.frame.obj: objects of class `data.frame'.

     ...: optional arguments to `print' or `plot' methods.

_D_e_t_a_i_l_s:

     Non-numeric variables passed to `data.frame' are converted to
     factor columns unless protected by `I'. This applies to character
     and logical variables, in particular. It also applies to adding
     columns to a data frame.

     If a list or data frame or matrix is passed to `data.frame' it is
     as if each column had been passed as a separate argument, with the
     exception of matrices of class `model.matrix'.

_V_a_l_u_e:

     For `data.frame(.)' a data frame, a matrix-like stucture whose
     columns may be of differing types (numeric, factor and character).

     `as.data.frame' is generic function with many `methods'. It
     attempts to coerce its argument to be a data frame.

     `is.data.frame' returns `TRUE' if its argument is a data frame and
     `FALSE' otherwise.

     `row.names' can be used to set and retrieve the row names of a
     data frame, similarly to `rownames' for arrays.

     `plot.data.frame', a method of the `plot' generic, uses
     `stripplot' for one variable, `plot.default' (scatterplot) for two
     variables, and `pairs' (scatterplot matrix) otherwise.

     For the `print' method (`print.data.frame'), see `print.matrix'.

     `xpdrows.data.frame' is an auxiliary function which expands the
     rows of a data frame.  It is used by the data frame methods of
     `[<-' and `[[<-' (which perform subscripted assignments on a data
     frame), and not intended to be called directly.

_S_e_e _A_l_s_o:

     `read.table', `Math.data.frame',etc, about Group methods for
     `data.frame's;  `make.names'.

_E_x_a_m_p_l_e_s:

     L3 <- LETTERS[1:3]
     str(d <- data.frame(cbind(x=1, y=1:10), ch=sample(L3, 10, repl=TRUE)))
     str(     data.frame(cbind(  1,   1:10),    sample(L3, 10, repl=TRUE)))
     is.data.frame(d)
     all(1:10 == row.names(d))# TRUE (coercion)

