as.Grid.default: Coercion to 'Grid'

Description Usage Arguments Details Value Note Examples

Description

Coercion to Grid.

Usage

1
2
## Default S3 method:
as.Grid(object, ...)

Arguments

object

An object to be coerced into a Grid object.

...

Not used yet.

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.

Value

Object with S4 class "Grid".

Note

A numeric object is coerced into a Grid object with dimension d =1.

Examples

1
2
3
4
5
6
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))

smint documentation built on April 14, 2017, 1:49 p.m.