英文:
How could it be possible coercing the QCA_mm class objvet into a table?
问题
我有这个表格,是从QCA包的truthTable()和minimize()函数的输出中生成的。
我正在努力找到一种将这个QCA_min`对象强制转换为flextable的方法(或者我甚至可以使用另一种工具来创建表格)。重要的是,我想用足够的陈述来复制方程:
M1: ~DEV + ~STB <-> ~SURV
你有什么建议吗?
谢谢
library(QCA)
ttLCn <- truthTable(LC, ~SURV, sort.by = "incl, n", show.cases = TRUE)
pLCn <- minimize(ttLCn, include = "?", details = TRUE)
pLCn
英文:
I have this table, produced as output from the truthTable() and minimize() functions of the package QCA
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
答案1
得分: 1
这不是很漂亮,但你可以看到值是如何通过查看QCA:::print.QCA_min
函数创建的。这是提取信息的一种方法:
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
这返回一个包含两个元素的列表。capture_qca(pLCn)[[1]]
是公式部分,capture_qca(pLCn)[[2]]
是一个数据框,你可以传递给 flextable。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论