knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )

library(QCAcluster) library(knitr) # nicer html tables

For illustration, we use data from Schwarz 2016. The data structure is an unbalanced panel with eight countries, ten years and 74 observations in total. `partition_div()`

requires as input only parameters for the calculation of the pooled solution plus identifiers for the units (`units`

) and periods (`time`

).

# load data (see data description for details) data(Schwarz2016) Schwarz_div <- partition_div(Schwarz2016, units = "country", time = "year", cond = c("poltrans", "ecotrans", "reform", "conflict", "attention"), out = "enlarge", 1, 0.8) kable(Schwarz_div)

The dataframe shows how the cases are distributed across truth table rows. The information is presented in absolute numbers and relative terms and for all truth table rows and the subset of consistent and inconsistent rows.

The table shows that while the pooled data covers 11 truth table rows, the maximum number of rows that a partition covers is 5, which equals about 45% of all rows. The minimum number of diversity is represented by the partition for the year 2013 because it covers only one row.

The output of the function can also be used to see whether all cases of a partition fall into consistent or inconsistent rows. Whenever the value for `diversity_1`

or `diversity_0`

is 0, there is no variation in the type of row for the partition. In this example, this concerns `r nrow(Schwarz_div[Schwarz_div$diversity_1 == 0 | Schwarz_div$diversity_0 == 0, ])`

partitions.

Yihui Xie (2021): *knitr: A General-Purpose Package for Dynamic Report Generation in
R.* R package version 1.33.

Yihui Xie (2015): *Dynamic Documents with R and knitr.* 2nd edition. Chapman and
Hall/CRC. ISBN 978-1498716963

Yihui Xie (2014): *knitr: A Comprehensive Tool for Reproducible Research in R.* In
Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors, Implementing
Reproducible Computational Research. Chapman and Hall/CRC. ISBN 978-1466561595

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.