12666727b9
12666727b9

Reputation: 1139

How could it be possible coercing the QCA_mm class objvet into a table?

I have this table, produced as output from the truthTable() and minimize() functions of the package QCA

enter image description here

I am struggling with finding some method for coercing this QCA_min` object into a flextable (or I could even use another tool for creating a table). Important is fact the I would like to reproduce the equation with the sufficient statement:

M1: ~DEV + ~STB <-> ~SURV

Would you have any suggestions?

Thanks

library(QCA)
ttLCn <- truthTable(LC, ~SURV, sort.by = "incl, n", show.cases = TRUE)
pLCn <- minimize(ttLCn, include = "?", details = TRUE)
pLCn  

Upvotes: 1

Views: 50

Answers (1)

MrFlick
MrFlick

Reputation: 206486

This isn't exactly pretty but you can see how the values are created by looking at the QCA:::print.QCA_min function. Here's a way to extract that infromation

capture_qca <- function(x) {
  m <- NULL
  suppressMessages(trace(admisc::prettyString, exit = function() m <<- returnValue(), print=TRUE))
  capture.output(QCA:::print.QCA_min(x))
  list(m, x$IC$incl.cov)
}
capture_qca(pLCn)
# [[1]]
# [1] "~DEV + ~STB <-> ~SURV"
# 
# [[2]]
#      inclS PRI covS covU                      cases
# ~DEV     1   1  0.8  0.3 GR,PT,ES; IT,RO; HU,PL; EE
# ~STB     1   1  0.7  0.2    GR,PT,ES; HU,PL; AU; DE

This returns a list with two elements. capture_qca(pLCn)[[1]] is the formula part and capture_qca(pLCn)[[2]] is a data.frame you can pass to flextable.

Upvotes: 1

Related Questions