Learn R Programming

cna (version 3.6.2)

condList-methods: 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 condList
summary(object, ...)

# S3 method for condList as.data.frame(x, row.names = attr(x, "cases"), optional = TRUE, nobs = 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.

nobs

Logical; if TRUE, the returned data frame has a column named “n.obs” indicating how many cases instantiate a given configuration in the data.

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

Run this code
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)
as.data.frame(csfList, nobs = 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)
  

Run the code above in your browser using DataLab