as.data.frame.pstructure: Coerces a pstructure.object to a data.frame.

View source: R/pstructure.v4.r

as.data.frame.pstructureR Documentation

Coerces a pstructure.object to a data.frame.

Description

Coerces a pstructure.object, which is of class pstructure, to a data.frame. One can choose whether or not to include the marginality matrix in the data.frame. The aliasing component is excluded.

Usage

## S3 method for class 'pstructure'
as.data.frame(x, row.names = NULL, optional = FALSE, ..., 
              omit.marginality = FALSE)

Arguments

x

The pstructure.object, which is of class pstructure and is to be coerced.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

A logical passed to as.data.frame. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of

data.frame(*, check.names = !optional).

...

Further arguments passed to or from other methods.

omit.marginality

A logical, which, if TRUE, results in the marginality matrix being omitted from the data.frame.

Value

A data.frame with as many rows as there are non-aliased terms in the pstructure.object. The columns are df, terms, sources and, if omit.marginality is FALSE, the columns of the generated levels with columns of the marginality matrix that is stored in the marginality component of the object.

Author(s)

Chris Brien

See Also

as.data.frame.

Examples

## Generate a data.frame with 4 factors, each with three levels, in standard order
ABCD.lay <- fac.gen(list(A = 3, B = 3, C = 3, D = 3))

## create a pstructure object based on the formula ((A*B)/C)*D
ABCD.struct <- pstructure.formula(~ ((A*B)/C)*D, data =ABCD.lay)

## print the object either using the Method function or the generic function 
ABCS.dat <- as.data.frame.pstructure(ABCD.struct)
as.data.frame(ABCD.struct)

dae documentation built on June 22, 2024, 9:07 a.m.