Create Data Frame from Marginal Grid

DESCRIPTION:
expand.grid creates a dataframe containing all combinations of the various arguments.

USAGE:
expand.grid(...)

REQUIRED ARGUMENTS:
...:
Vectors, factors, or a list containing these. The arguments may be named, in which case the names will be used in the result. Default variable names are "Var" followed by an integer.

VALUE:
a dataframe containing all combinations of the various arguments. The result of expand.grid has an attribute, out.attrs that is a list of attributes suitable for turning any of the variables in the result, or any similar vector, into an array.

Function expand.grid is most often used in conjunction with predict to produce fitted values from a model at a regular grid of values of the dependent variables. When a data frame with the out.attrs attribute is passed to predict, it will apply these attribute to its result, producing an array.


EXAMPLES:
grid <- list(height=seq(60,80,5),weight=seq(100,300,50),
      sex=c("Male","Female"))
fit <- predict(fitted.model, expand.grid(grid))