condList-methods: Methods for class "condList"

condList-methodsR Documentation

Methods for class “condList”

Description

The output of the condition function is a nested list of class “condList” that contains one or several data frames. The utilities in condList-methods are suited for rendering or reshaping these objects in different ways.

Usage

## S3 method for class 'condList'
summary(object, ...)

## S3 method for class 'condList'
as.data.frame(x, row.names = attr(x, "cases"), optional = TRUE, ...)

group.by.outcome(object, cases = TRUE)

Arguments

object,x

An object of class “condList”, the output of the condition function.

...

Not used.

row.names,optional

As in as.data.frame.

cases

Logical; if TRUE, the returned data frame has a column named “cases”.

Details

The summary method for class “condList” prints the output of condition in a condensed manner. It is identical to printing with print.table = FALSE, see print.condList.

The output of condition is a nested list of class “condList” that contains one or several data frames. The method as.data.frame is a variant of the base method as.data.frame. It offers a convenient way of combining the columns of the data frames in a condList into one regular data frame. Columns appearing in several tables (typically the modeled outcomes) are included only once in the resulting data frame. The output of as.data.frame has syntactically invalid column names by default, including operators such as "->" or "+". Setting optional = FALSE converts the column names into syntactically valid names (using make.names).

group.by.outcome takes a condlist as input and combines the entries in that nested list into a data frame with a larger number of columns, combining all columns concerning the same outcome into the same data frame. The additional attributes (consistency etc.) are thereby removed.

See Also

condition

Examples

ana1 <- cna(d.educate)
(csfList <- condition(csf(ana1)$condition, d.educate))
as.data.frame(csfList)
as.data.frame(csfList[1]) # Include the first condition only
as.data.frame(csfList, row.names = NULL)
as.data.frame(csfList, optional = FALSE)

(asfList <- condition(asf(ana1)$condition, d.educate))
as.data.frame(asfList)  
group.by.outcome(asfList)
summary(asfList)

(mscList <- condition(msc(ana1)$condition, d.educate))
as.data.frame(mscList) 
group.by.outcome(mscList)
summary(mscList)
  

cna documentation built on Aug. 11, 2023, 1:09 a.m.