Learn R Programming

smint (version 0.4.2)

as.Grid.default: Coercion to Grid

Description

Coercion to Grid.

Usage

"as.Grid"(object, ...)

Arguments

object
An object to be coerced into a Grid object.
...
Not used yet.

Value

Object with S4 class "Grid".

Details

The dimensions of the Grid object are matched to the $d$ columns of the object given in object, in the same order. Each column is coerced into a factor. Each combination of the $d$ different levels must be found exactly one in the data frame or matrix, and the the row number of that combination is stored in the index slot of the object.

Examples

Run this code
set.seed(1234)
GDnum <- as.Grid(runif(8))
GDlist <- as.Grid(list("X" = runif(8), "Y" = runif(4)))
df <- expand.grid(X = runif(6), Y = runif(4))
GDdf <- as.Grid(df)
GDmat <- as.Grid(as.matrix(df))

Run the code above in your browser using DataLab