[Qca-commits] r62 - in pkg: . R inst inst/staticdocs man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 12 01:23:43 CET 2018


Author: dusadrian
Date: 2018-11-12 01:23:43 +0100 (Mon, 12 Nov 2018)
New Revision: 62

Modified:
   pkg/DESCRIPTION
   pkg/R/translate.R
   pkg/inst/ChangeLog
   pkg/inst/staticdocs/QCA.package.html
   pkg/man/QCA.package.Rd
   pkg/src/QCA.c
Log:
version 3.3-5

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/DESCRIPTION	2018-11-12 00:23:43 UTC (rev 62)
@@ -1,6 +1,6 @@
 Package: QCA
 Version: 3.3-5
-Date: 2018-11-06
+Date: 2018-11-12
 Title: Qualitative Comparative Analysis
 Authors at R: c(person("Adrian", "Dusa", role = c("aut", "cre", "cph"),
                     email = "dusa.adrian at unibuc.ro"),
@@ -28,7 +28,7 @@
              minimal causal combination that explains a given phenomenon.
 License: GPL (>= 2)
 NeedsCompilation: yes
-Packaged: 2018-11-06 11:58:54 UTC; dusadrian
+Packaged: 2018-11-11 23:56:49 UTC; dusadrian
 Author: Adrian Dusa [aut, cre, cph],
   jQuery Foundation [cph] (jQuery library and jQuery UI library),
   jQuery contributors [ctb, cph] (jQuery library; authors listed in

Modified: pkg/R/translate.R
===================================================================
--- pkg/R/translate.R	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/R/translate.R	2018-11-12 00:23:43 UTC (rev 62)
@@ -152,7 +152,7 @@
             }
             empty <- FALSE
             for (i in seq(length(conds))) {
-                if (conds[i] %in% remtilde[dupnot]) { 
+                if (is.element(conds[i], remtilde[dupnot])) { 
                     wdup <- which(remtilde == conds[i])
                     inx[[wdup[1]]] <- intersect(inx[[wdup[1]]], inx[[wdup[2]]])
                     if (length(wdup) > 2) {
@@ -171,6 +171,11 @@
             return(ret)
         })
         names(retlist) <- pporig
+        retlist <- retlist[!unlist(lapply(retlist, function(x) any(unlist(lapply(x, length)) == 0)))]
+        if (length(retlist) == 0) {
+            cat("\n")
+            stop(simpleError("The result is an empty set.\n\n"))
+        }
     }
     else {
         pp <- unlist(strsplit(expression, split = "[+]"))

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/inst/ChangeLog	2018-11-12 00:23:43 UTC (rev 62)
@@ -1,5 +1,6 @@
 Version 3.4
-    o New: conjunctural directional expectations finally implemented
+    o New: complete re-write of the code treating the directional expectations,
+      now also implementing conjunctural directional expectations
       (thanks to Carsten Schneider for the persistence)
     o New: function findRows() gains a new three dots argument "..." to
       allow passing a combination of cutoff values to function truthTable()
@@ -15,7 +16,8 @@
     o Improved: function pofind() now accepts multivalue data
       (thanks to Hanieh Moshki for the suggestion)
     o Fixed: long overdue bug that failed to identify all easy counterfactuals
-      for certain types of directional expectations
+      for certain types of directional expectations involving multiple values
+      and / or multiple don't cares
     o Fixed: bug in printing the cases, when they contain multi-byte
       characters (thanks to Stefan Verweij for the report)
     o Changed: all C level functions are now renamed using a "C_" prefix,

Modified: pkg/inst/staticdocs/QCA.package.html
===================================================================
--- pkg/inst/staticdocs/QCA.package.html	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/inst/staticdocs/QCA.package.html	2018-11-12 00:23:43 UTC (rev 62)
@@ -121,7 +121,7 @@
 </tr><tr><td> 3.3-5 </td>
 </tr><tr><td>
     Date:    </td>
-</tr><tr><td> 2018-11-06 </td>
+</tr><tr><td> 2018-11-12 </td>
 </tr><tr><td>
     License: </td>
 </tr><tr><td> GPL (>= 2)</td>

Modified: pkg/man/QCA.package.Rd
===================================================================
--- pkg/man/QCA.package.Rd	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/man/QCA.package.Rd	2018-11-12 00:23:43 UTC (rev 62)
@@ -56,7 +56,7 @@
     Package: \tab QCA\cr
     Type:    \tab Package\cr
     Version: \tab 3.3-5\cr
-    Date:    \tab 2018-11-06\cr
+    Date:    \tab 2018-11-12\cr
     License: \tab GPL (>= 2)\cr
     }
 }

Modified: pkg/src/QCA.c
===================================================================
--- pkg/src/QCA.c	2018-11-06 12:02:30 UTC (rev 61)
+++ pkg/src/QCA.c	2018-11-12 00:23:43 UTC (rev 62)
@@ -2384,8 +2384,6 @@
 }
 SEXP C_getEC(SEXP aleabune, SEXP veverita, SEXP catelus, SEXP ursulet, SEXP ratusca, SEXP ametist) {
     SEXP usage = PROTECT(allocVector(VECSXP, 6));
-    SEXP dimnames;
-    SET_VECTOR_ELT(usage, 0, dimnames = allocVector(VECSXP, 2));
     int *p_aleabune   = INTEGER(aleabune);
     int *p_veverita = INTEGER(veverita);
     int *p_catelus = INTEGER(catelus);
@@ -2480,35 +2478,60 @@
                         c++;
                     }
                     if (dinfata) {
-                        Rboolean stacana = FALSE;
-                        int c = 0;
-                        while (!stacana && c < nc_aleabune) {
-                            stacana = cenusiu[c];
-                            c++;
-                        }
-                        if (stacana) { 
-                            if (cronicar > 0) { 
-                                for (int c = 0; c < nc_aleabune; c++) {
-                                    Rboolean maroniu = FALSE;
-                                    if (cenusiu[c]) {
-                                        int r = 0;
-                                        while (!maroniu && r < cronicar) {
-                                            maroniu = p_aleabune[c * nr_aleabune + p_carare[r]] == calare[c];
-                                            r++;
+                        if (cronicar > 0) { 
+                            for (int c = 0; c < nc_aleabune; c++) {
+                                balarie[c] = pejos[c];
+                                if (cenusiu[c]) {
+                                    Rboolean banana = TRUE;
+                                    for (int r = 0; r < cronicar; r++) {
+                                        int galetusa = p_aleabune[c * nr_aleabune + p_carare[r]];
+                                        if (galetusa > 0) {
+                                            banana = FALSE;
+                                            if (galetusa == calare[c]) {
+                                                balarie[c] = galetusa;
+                                            }
                                         }
                                     }
-                                    balarie[c] = maroniu ? calare[c] : pejos[c];
+                                    if (banana) {
+                                        balarie[c] = calare[c];
+                                    }
                                 }
-                                Rboolean nerod = TRUE;
+                            }
+                            for (int r = 0; r < nr_alearele; r++) {
+                                if (!palarie[r]) {
+                                    Rboolean nerod = TRUE;
+                                    int c = 0;
+                                    while (nerod && c < nc_aleabune) {
+                                        nerod = (balarie[c] > 0) ? p_alearele[c * nr_alearele + r] + 1 == balarie[c] : TRUE;
+                                        c++;
+                                    }
+                                    palarie[r] = nerod;
+                                }
+                            }
+                        }
+                        if (alambic > 0) { 
+                            for (int r = 0; r < alambic; r++) {
+                                Rboolean toatecele = TRUE;
                                 int c = 0;
-                                while (nerod && c < nc_aleabune) {
-                                    nerod = balarie[c] == pejos[c];
+                                while (toatecele && c < nc_aleabune ) {
+                                    balarie[c] = pejos[c];
+                                    if (cenusiu[c]) {
+                                        int galetusa = p_aleabune[c * nr_aleabune + p_poteca[r]];
+                                        if (galetusa > 0) {
+                                            if (!rosiatic[c]) { 
+                                                toatecele = galetusa == calare[c];
+                                                if (toatecele) {
+                                                    balarie[c] = galetusa;
+                                                }
+                                            }
+                                        }
+                                    }
                                     c++;
                                 }
-                                if (!nerod) {
+                                if (toatecele) {
                                     for (int r = 0; r < nr_alearele; r++) {
                                         if (!palarie[r]) {
-                                            nerod = TRUE;
+                                            Rboolean nerod = TRUE;
                                             int c = 0;
                                             while (nerod && c < nc_aleabune) {
                                                 nerod = (balarie[c] > 0) ? p_alearele[c * nr_alearele + r] + 1 == balarie[c] : TRUE;
@@ -2519,38 +2542,6 @@
                                     }
                                 }
                             }
-                            if (alambic > 0) { 
-                                for (int r = 0; r < alambic; r++) {
-                                    Rboolean toatecele = TRUE;
-                                    Rboolean maruntis = FALSE;
-                                    int c = 0;
-                                    while (toatecele && c < nc_aleabune ) {
-                                        int galetusa = p_aleabune[c * nr_aleabune + p_poteca[r]];
-                                        balarie[c] = pejos[c];
-                                        if (galetusa > 0 && pejos[c] == 0) {
-                                            toatecele = galetusa == calare[c]; 
-                                            if (toatecele) {
-                                                maruntis = TRUE;
-                                                balarie[c] = galetusa; 
-                                            }
-                                        }
-                                        c++;
-                                    }
-                                    if (maruntis && toatecele) {
-                                        for (int r = 0; r < nr_alearele; r++) {
-                                            if (!palarie[r]) {
-                                                Rboolean nerod = TRUE;
-                                                int c = 0;
-                                                while (nerod && c < nc_aleabune) {
-                                                    nerod = (balarie[c] > 0) ? p_alearele[c * nr_alearele + r] + 1 == balarie[c] : TRUE;
-                                                    c++;
-                                                }
-                                                palarie[r] = nerod;
-                                            }
-                                        }
-                                    }
-                                }
-                            }
                         }
                     }
                 } 
@@ -2565,7 +2556,9 @@
             SEXP incepute;
             SET_VECTOR_ELT(usage, 4, incepute = VECTOR_ELT(getAttrib(alearele, R_DimNamesSymbol), 0));
             SEXP lafinal;
-            SET_VECTOR_ELT(usage, 5, lafinal = allocVector(STRSXP, toatealea));
+            SET_VECTOR_ELT(usage, 5, lafinal = allocVector(STRSXP, toatealea)); 
+            SEXP dimnames;
+            SET_VECTOR_ELT(usage, 0, dimnames = allocVector(VECSXP, 2));
             int ecr = 0;
             for (int r = 0; r < nr_alearele; r++) {
                 if (palarie[r]) {
@@ -2576,7 +2569,7 @@
                     ecr++;
                 }
             }
-            SET_VECTOR_ELT(dimnames, 0, lafinal);
+            SET_VECTOR_ELT(dimnames, 0, duplicate(lafinal));
             if (hasColnames(veverita)) {
                 SET_VECTOR_ELT(dimnames, 1, VECTOR_ELT(getAttrib(veverita, R_DimNamesSymbol), 1));
             }



More information about the Qca-commits mailing list