Search code examples
rerror-handlinganalysis

how to deal with superSubset()


I have this dataset

dput(head(df1, 10))
structure(list(ID = 1:10, V = c(0, 1, 1, 1, 0, 1, 0, 1, 0, 
0), Puk = c(1, 1, 1, 1, 0, 1, 0, 0, 0, 1), Tall = c(1, 1, 1, 1, 
1, 1, 0, 1, 0, 0), Sit = c(1, 0, 1, 0, 0, 0, 0, 0, 1, 0), STS = c(1, 
1, 1, 1, 0, 0, 0, 0, 0, 0), tlf = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 
1), score = c(0.99, 0.99, 1, 0.99, 0.33, 0.67, 0.33, 0.33, 0.33, 
0.33)), class = c("rowwise_df", "tbl_df", "tbl", "data.frame"
), row.names = c(NA, -10L), groups = structure(list(.rows = structure(list(
    1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), ptype = integer(0), class = c("vctrs_list_of", 
"vctrs_vctr", "list"))), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame")))

where I am trying to perform the qualitative comparative analysis. I have run the following function for the necessity analysis.

package(QCA)
superSubset(df1,outcome="score", 
            conditions="V,Puk,Sit,Tall, STS,tlf", relation = "necessity", 
            incl.cut=0.9, cov.cut=0.6,ron.cut = 0.6)

but I am obtaining this error:

Error in superSubset(df1, outcome = "score", conditions = "V,Puk,Sit,Tall, STS,tlf",  : 
  'list' object cannot be coerced to type 'double'

Unfortunately I cannot figure out which problem is going on. Wouòd you have any tips with it?

Thanks


Solution

  • This is one of those instances when your tibble needs to be a data.frame.

    library(QCA)
    
    superSubset(as.data.frame(df1),outcome="score", relation = "necessity", 
                 incl.cut=0.9, cov.cut=0.6, ron.cut = 0.2)
                                        inclN   RoN   covN  
    ------------------------------------------------------- 
     1  ID[3] + tlf[0]                  0.948  0.248  0.662 
     2  V[0] + Puk[1]                   0.948  0.248  0.662 
     3  V[1] + tlf[0]                   0.948  0.248  0.662 
     4  Puk[0] + Tall[1]                0.948  0.248  0.662 
     5  Puk[1] + Sit[0]                 0.948  0.248  0.662 
     6  Tall[1] + Sit[0]                0.948  0.248  0.662 
     7  Tall[1] + tlf[0]                0.948  0.248  0.662 
     8  Sit[0] + STS[1]                 0.948  0.248  0.662 
     9  Sit[1] + tlf[0]                 0.948  0.248  0.662 
    10  STS[1] + tlf[0]                 0.948  0.248  0.662 
    11  ID[1] + V[1] + Puk[0]           0.948  0.248  0.662 
    12  ID[1] + V[1] + Tall[0]          0.948  0.248  0.662 
    13  ID[1] + V[1] + Sit[0]           0.948  0.248  0.662 
    14  ID[6] + V[0] + STS[1]           0.948  0.248  0.662 
    15  ID[5] + Puk[1] + Tall[0]        0.948  0.248  0.662 
    16  ID[7] + Puk[1] + Tall[1]        0.948  0.248  0.662 
    17  ID[8] + Puk[1] + Tall[0]        0.948  0.248  0.662 
    18  ID[9] + Puk[1] + Tall[1]        0.948  0.248  0.662 
    19  ID[6] + Puk[0] + STS[1]         0.948  0.248  0.662 
    20  ID[7] + Tall[1] + Sit[1]        0.948  0.248  0.662 
    21  ID[10] + Tall[1] + Sit[1]       0.948  0.248  0.662 
    22  ID[7] + Tall[1] + tlf[1]        0.948  0.248  0.662 
    23  ID[9] + Tall[1] + tlf[1]        0.948  0.248  0.662 
    24  ID[1] + Sit[0] + tlf[1]         0.948  0.248  0.662 
    25  V[1] + Puk[1] + Tall[0]         0.948  0.248  0.662 
    26  V[1] + Puk[0] + Sit[1]          0.948  0.248  0.662 
    27  V[1] + Puk[0] + STS[1]          0.948  0.248  0.662 
    28  V[1] + Tall[0] + Sit[1]         0.948  0.248  0.662 
    29  V[1] + Tall[0] + STS[1]         0.948  0.248  0.662 
    30  Puk[1] + Tall[1] + Sit[1]       0.948  0.248  0.662 
    31  Tall[1] + Sit[1] + tlf[1]       0.948  0.248  0.662 
    32  ID[5] + V[1] + Puk[1] + Sit[1]  0.948  0.248  0.662 
    33  ID[7] + V[1] + Puk[1] + Sit[1]  0.948  0.248  0.662 
    34  ID[5] + V[1] + Sit[1] + tlf[1]  0.948  0.248  0.662 
    35  ID[7] + V[1] + Sit[1] + tlf[1]  0.948  0.248  0.662 
    -------------------------------------------------------