ct2df: Transform a configuration table into a data frame

View source: R/ct2df.r

ct2dfR Documentation

Transform a configuration table into a data frame

Description

ct2df transforms a configuration table into a data frame. This is the converse function of configTable.

The method as.data.frame for class “configTable” does a similar job, but ignores case frequencies.

Usage

ct2df(ct)

## S3 method for class 'configTable'
as.data.frame(x, ..., warn = TRUE)

Arguments

ct, x

A configTable.

...

Currently not used.

warn

Logical; if TRUE and case frequencies in input are not all equal to 1, a warning is issued.

Details

The function ct2df transforms a configTable into a data frame by rendering rows corresponding to several cases in the configTable as multiple rows in the resulting data frame. In contrast, as.data.frame(x) simply drops the case frequencies without accounting for multiple identical cases and turns the configTable into a data frame.

Value

A data.frame.

See Also

configTable, data.frame

Examples

ct.educate <- configTable(d.educate[1:2])
ct.educate
ct2df(ct.educate) # the resulting data frame has 8 rows
as.data.frame(ct.educate) # the resulting data frame has 4 rows

dat1 <- some(configTable(allCombs(c(2, 2, 2, 2, 2)) - 1), n = 200, replace = TRUE)
dat2 <- selectCases("(A*b + a*B <-> C)*(C*d + c*D <-> E)", dat1)
dat2 
ct2df(dat2)
as.data.frame(dat2)

dat3 <- data.frame(
  A = c(1,1,1,1,1,1,0,0,0,0,0),
  B = c(1,1,1,0,0,0,1,1,1,0,0),
  C = c(1,1,1,1,1,1,1,1,1,0,0),
  D = c(1,0,0,1,0,0,1,1,0,1,0),
  E = c(1,1,0,1,1,0,1,0,1,1,0)
  )
ct.dat3 <- configTable(dat3, frequency = c(4,3,5,7,4,6,10,2,4,3,12))
ct2df(ct.dat3)
as.data.frame(ct.dat3)

cna documentation built on April 11, 2025, 6:10 p.m.