schema: Schema

Description Usage Arguments Details Value See Also Examples

View source: R/schema.R

Description

Get the schema of a data object.

Usage

1
schema(x)

Arguments

x

an object.

Details

The schema function returns the type of a data object:

  1. the schema of NULL is NULL;

  2. the scheme of a vector-like argument x is x;

  3. the schema of a record or dataset x is a record with the

    same names, with each field giving the schema of the corresponding entry in x

  4. the schema of a matrix-like argument x is the schema of as.dataset(x).

Note that schema(x) is undefined for rank-3 and higher arrays.

Value

A type (length-0 vector-like object) or a record with entries giving the schema of the corresponding columns in x.

See Also

cast.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# vector-like arguments
schema(letters)
schema(1:10)

# vector-like argument
x <- record(a = 1:10, b = LETTERS, c = FALSE)
schema(x)

# matrix-like
schema(iris)

# nested dataset
nest <- dataset(one = letters,
                two = 1:26,
                three = dataset(foo = rep(FALSE, 26),
                                bar = NULL))
schema(nest)

patperry/r-frame documentation built on May 6, 2019, 8:34 p.m.