CRAN Package Check Results for Package pcalg

Last updated on 2019-11-26 00:52:01 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 2.6-8 112.59 433.48 546.07 OK
r-devel-linux-x86_64-debian-gcc 2.6-8 82.68 325.03 407.71 OK
r-devel-linux-x86_64-fedora-clang 2.6-8 584.14 ERROR
r-devel-linux-x86_64-fedora-gcc 2.6-8 572.57 ERROR
r-devel-windows-ix86+x86_64 2.6-8 179.00 614.00 793.00 NOTE
r-devel-windows-ix86+x86_64-gcc8 2.6-8 201.00 772.00 973.00 ERROR
r-patched-linux-x86_64 2.6-8 90.77 407.30 498.07 OK
r-patched-solaris-x86 2.6-8 788.10 NOTE
r-release-linux-x86_64 2.6-8 85.00 418.22 503.22 OK
r-release-windows-ix86+x86_64 2.6-8 188.00 589.00 777.00 NOTE
r-release-osx-x86_64 2.6-8 NOTE
r-oldrel-windows-ix86+x86_64 2.6-8 208.00 565.00 773.00 NOTE
r-oldrel-osx-x86_64 2.6-8 NOTE

Check Details

Version: 2.6-8
Check: installed package size
Result: NOTE
     installed size is 12.0Mb
     sub-directories of 1Mb or more:
     data 2.1Mb
     libs 6.7Mb
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-windows-ix86+x86_64, r-devel-windows-ix86+x86_64-gcc8, r-patched-solaris-x86, r-release-windows-ix86+x86_64, r-release-osx-x86_64, r-oldrel-windows-ix86+x86_64, r-oldrel-osx-x86_64

Version: 2.6-8
Check: examples
Result: ERROR
    Running examples in ‘pcalg-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: adjustment
    > ### Title: Compute adjustment sets for covariate adjustment.
    > ### Aliases: adjustment
    > ### Keywords: models graphs
    >
    > ### ** Examples
    >
    > ## Example 4.1 in Perkovic et. al (2015), Example 2 in Perkovic et. al (2017)
    > mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
    + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
    > type <- "cpdag"
    > x <- 3; y <- 6
    > ## plot(as(t(mFig1), "graphNEL"))
    >
    > ## all
    > if(requireNamespace("dagitty")) {
    + adjustment(amat = mFig1, amat.type = type, x = x, y = y, set.type =
    + "all")
    + }
    Loading required namespace: dagitty
    
    
    #
    # Fatal error in , line 0
    # Failed to create ICU collator, are ICU data files missing?
    #
    #
    #
    #FailureMessage Object: 0x7ffe2af61360
    ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7fe80222c45a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7fe8017b48b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7fe802227f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7fe801f09413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7fe80202e4a2]
     [0x1bc2a16dc0d8]
    
     *** caught illegal operation ***
    address 0x7fe8015f29a5, cause 'illegal operand'
    
    Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
    10: pcalg2dagitty(amat = amat, labels = lb, type = amat.type)
    11: adjustment(amat = mFig1, amat.type = type, x = x, y = y, set.type = "all")
    An irrecoverable exception occurred. R is aborting now ...
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 2.6-8
Check: tests
Result: ERROR
     Running ‘test_LINGAM.R’
     Running ‘test_addBgKnowledge.R’
     Running ‘test_adjustment.R’
     Running ‘test_ages.R’
     Running ‘test_amat2dag.R’
     Running ‘test_arges.R’
     Running ‘test_backdoor.R’ [10s/12s]
     Comparing ‘test_backdoor.Rout’ to ‘test_backdoor.Rout.save’ ... OK
     Running ‘test_bicscore.R’
     Running ‘test_causalEffect.R’
     Running ‘test_coercion.R’
     Running ‘test_compareGraphs.R’
     Running ‘test_dag2cpdag.R’
     Running ‘test_dag2essgraph.R’
     Running ‘test_displayAmat.R’
     Running ‘test_dsep.R’
     Running ‘test_fci.R’
     Running ‘test_fciPlus.R’
     Running ‘test_gSquareBin.R’
     Running ‘test_gSquareDis.R’
     Running ‘test_gac.R’
     Running ‘test_getNextSet.R’
     Running ‘test_gies.R’
     Running ‘test_ida.R’ [86s/93s]
     Running ‘test_idaFast.R’
     Running ‘test_isValidGraph.R’
     Running ‘test_jointIda.R’
     Running ‘test_mat2targets.R’
     Running ‘test_optAdjSet.R’
     Running ‘test_opttarget.R’
     Running ‘test_pc.R’
     Running ‘test_pcSelect.R’
     Running ‘test_pcalg2dagitty.R’
     Running ‘test_pcorOrder.R’
     Running ‘test_pdag2allDags.R’
     Running ‘test_pdag2dag.R’
     Running ‘test_possDeAn.R’
     Running ‘test_randDAG.R’
     Comparing ‘test_randDAG.Rout’ to ‘test_randDAG.Rout.save’ ... OK
     Running ‘test_randomDAG.R’
     Running ‘test_rfci.R’
     Running ‘test_rmvDAG.R’
     Running ‘test_shd.R’
     Running ‘test_skeleton.R’
     Running ‘test_udag2pag.R’
     Running ‘test_udag2pdag.R’
     Running ‘test_wgtMatrix.R’
    Running the tests in ‘tests/test_adjustment.R’ failed.
    Complete output:
     > if(requireNamespace("dagitty")) {
     + library(pcalg)
     + (doExtras <- pcalg:::doExtras())
     +
     + ## Minimalistic CRAN checks
     +
     + ## Test 1 ############################
     + ## Test that "no adjustment set" and "empty adjustment set" are distinguished properly
     + x <- 1; y <- 2
     + cpdag <- matrix(c(0,1,1,0),2,2) ## 1 --- 2 => no adj set
     + dag <- matrix(c(0,1,0,0),2,2) ## 1 --> 2 => empty adj set
     +
     + adjC <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     + adjD <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "canonical")
     + adjP <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "canonical")
     +
     + stopifnot(!identical(adjC, adjD), identical(adjD, adjP) )
     +
     + ## Test 2 ###############################
     + gacVSadj <- function(amat, x, y ,z, V, type) {
     + ## gac(z) is TRUE IFF z is returned by adjustment()
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     + gacRes <- gac(amat,x,y, z, type)$gac
     + adjRes <- adjustment(amat = amat, amat.type = typeDG, x = x, y = y, set.type = "all")
     + if (gacRes) { ## z is valid adj set
     + res <- any(sapply(adjRes, function(xx) setequal(z, xx)))
     + } else { ## z is not valid adj set
     + res <- all(!sapply(adjRes, function(xx) setequal(z, xx)))
     + }
     + res
     + }
     +
     + xx <- TRUE
     +
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5), V=V, type)
     +
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSadj(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSadj(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 2, V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSadj.")
     + } else {
     + message("OK, no issues were found.")
     + }
     +
     + ############################################################
     + ## Extensive checks
     + ############################################################
     + if (doExtras) {
     +
     + ## Test that "no adjustment set" and "empty adjustment set" are distinguished properly
     + x <- 1; y <- 2
     + cpdag <- matrix(c(0,1,1,0),2,2) ## 1 --- 2 => no adj set
     + dag <- matrix(c(0,1,0,0),2,2) ## 1 --> 2 => empty adj set
     +
     + adjC <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     + adjD <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "canonical")
     + adjP <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "canonical")
     +
     + stopifnot(!identical(adjC, adjD), identical(adjD, adjP) )
     +
     + adjCAll <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "all")
     + adjDAll <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "all")
     + adjPAll <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "all")
     +
     + stopifnot( !identical(adjCAll, adjDAll), identical(adjDAll, adjPAll) )
     +
     + adjCMin <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "minimal")
     + adjDMin <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "minimal")
     + adjPMin <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "minimal")
     +
     + stopifnot( !identical(adjCMin, adjDMin), identical(adjDMin, adjPMin) )
     +
     +
     + #####################################################################################
     + ## Test 1: Compare CPDAG and PDAG implementation and validate all sets using gac()
     + #####################################################################################
     + nreps <- 100
     + simRes <- data.frame(setType = rep(NA, nreps), id = rep(NA,nreps),
     + rtCPDAG = rep(NA,nreps), rtPDAG = rep(NA, nreps),
     + nSet = rep(NA, nreps), gacCheck = rep(NA, nreps))
     + proc.time()
     + for (i in 1:nreps) {
     + cat("i = ",i,"\n")
     + ## generate a graph
     + seed <- i
     + set.seed(seed)
     + p <- sample(x=5:10, size = 1)
     + prob <- sample(x=3:7/10, size = 1)
     + g <- pcalg:::randomDAG(p, prob) ## true DAG
     + cpdag <- dag2cpdag(g)
     + cpdag.mat <- t(as(cpdag,"matrix")) ## has correct encoding
     +
     + ## define input
     + amat <- cpdag.mat
     + x <- sample(x = 1:p, size = 1)
     + y <- sample(x = setdiff(1:p,x), size = 1)
     + set.type <- sample(x = c("all", "minimal"), size = 1)
     + simRes$setType[i] <- set.type
     +
     + ## run both methods
     + simRes$rtCPDAG[i] <- system.time(res1 <- adjustment(amat = amat, amat.type = "cpdag", x = x, y = y, set.type = set.type))[3]
     + simRes$rtPDAG[i] <- system.time(res2 <- adjustment(amat = amat, amat.type = "pdag", x = x, y = y, set.type = set.type))[3]
     + simRes$nSet[i] <- length(res1)
     +
     + if (length(res1) == 0) {
     + res1 <- vector("list", 0)
     + }
     + if (length(res2) == 0) {
     + res2 <- vector("list", 0)
     + }
     + ## compare results
     + simRes$id[i] <- identical(res1,res2)
     +
     + ## compare results with gac() based on "pdag"
     + if (length(res2) > 0) {
     + gc <- TRUE
     + for (j in 1:length(res2)) {
     + gc <- gc & gac(amat = amat, x = x, y = y, z = res2[[j]], type = "cpdag")$gac
     + }
     + simRes$gacCheck[i] <- gc
     + }
     +
     + }
     + proc.time()
     +
     + summary(simRes)
     + table(is.na(simRes$gacCheck), simRes$nSet == 0)
     +
     + ################################################
     + ## Test 2: Check using predefined graphs
     + ################################################
     + gacVSadj <- function(amat, x, y ,z, V, type) {
     + ## gac(z) is TRUE IFF z is returned by adjustment()
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     + gacRes <- gac(amat,x,y, z, type)$gac
     + adjRes <- adjustment(amat = amat, amat.type = typeDG, x = x, y = y, set.type = "all")
     + if (gacRes) { ## z is valid adj set
     + res <- any(sapply(adjRes, function(xx) setequal(z, xx)))
     + } else { ## z is not valid adj set
     + res <- all(!sapply(adjRes, function(xx) setequal(z, xx)))
     + }
     + res
     + }
     +
     + xx <- TRUE
     + ##################################################
     + ## DAG / CPDAG
     + ##################################################
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,5), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z= NULL, V=V, type)
     +
     + ## CPDAG 2: Paper Fig 5a
     + mFig5a <- matrix(c(0,1,0,0,0, 1,0,1,0,0, 0,0,0,0,1, 0,0,1,0,0, 0,0,0,0,0), 5,5)
     + V <- as.character(1:ncol(mFig5a))
     + rownames(mFig5a) <- colnames(mFig5a) <- V
     +
     + type <- "cpdag"
     + x <- c(1,5); y <- 4
     + xx <- xx & gacVSadj(mFig5a, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(mFig5a, x,y, z= 2, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSadj(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z=c(4,5), V=V, type)
     +
     + ## DAG 2 from Marloes' Talk
     + mMMd2 <- matrix(c(0,1,0,1,0,0, 0,0,0,0,0,0, 0,1,0,0,1,0,
     + 0,0,0,0,1,0, 0,0,0,0,0,1, 0,0,0,0,0,0), 6,6)
     + V <- as.character(1:ncol(mMMd2))
     + rownames(mMMd2) <- colnames(mMMd2) <- V
     +
     + type <- "dag"
     + x <- 4; y <- 6
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,5), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,2), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,3), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 2, V=V, type)
     +
     + ##################################################
     + ## PAG
     + ##################################################
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSadj(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3b <- matrix(c(0,2,0,0, 3,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3b))
     + rownames(mFig3b) <- colnames(mFig3b) <- V
     + xx <- xx & gacVSadj(mFig3b, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3c <- matrix(c(0,3,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3c))
     + rownames(mFig3c) <- colnames(mFig3c) <- V
     + xx <- xx & gacVSadj(mFig3c, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig4a <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,3,3,2,
     + 0,0,2,0,2,2, 0,0,2,1,0,2, 0,0,1,3,3,0), 6,6)
     + V <- as.character(1:ncol(mFig4a))
     + rownames(mFig4a) <- colnames(mFig4a) <- V
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(1,6), V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(2,6), V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(1,2,6), V=V, type)
     +
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- as.character(1:ncol(mFig4b))
     + rownames(mFig4b) <- colnames(mFig4b) <- V
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z=c(5,6), V=V, type)
     +
     + mFig5b <- matrix(c(0,1,0,0,0,0,0, 2,0,2,3,0,3,0, 0,1,0,0,0,0,0, 0,2,0,0,3,0,0,
     + 0,0,0,2,0,2,3, 0,2,0,0,2,0,0, 0,0,0,0,2,0,0), 7,7)
     + V <- as.character(1:ncol(mFig5b))
     + rownames(mFig5b) <- colnames(mFig5b) <- V
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5,3), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(1,3,4,5), V=V, type)
     +
     + ## PAG in Marloes' talk
     + mMMp <- matrix(c(0,0,0,3,2,0,0, 0,0,0,0,1,0,0, 0,0,0,0,1,0,0, 2,0,0,0,0,3,2,
     + 3,2,2,0,0,0,3, 0,0,0,2,0,0,0, 0,0,0,2,2,0,0), 7,7)
     + V <- as.character(1:ncol(mMMp))
     + rownames(mMMp) <- colnames(mMMp) <- V
     +
     + x <- c(5,6); y <- 7
     + xx <- xx & gacVSadj(mMMp, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,2), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,3), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,2,3), V=V, type)
     +
     + ##################################################
     + ## V=V, type = "pag" -- Tests from Ema
     + ##################################################
     + type <- "pag"
     + pag.m <- readRDS(system.file(package="pcalg", "external", "gac-pags.rds"))
     + m1 <- pag.m[["m1"]]
     + V <- colnames(m1)
     + x <- 6; y <- 9
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,7,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,7,8), V=V, type)
     +
     + x <- c(6,8); y <- 9
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,4), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,7), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,7), V=V, type)
     +
     + x <- 3; y <- 1
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=6, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,6), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,7,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,5,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,5,7,8), V=V, type)
     +
     + m2 <- pag.m[["m2"]]
     + V <- colnames(m2)
     + x <- 3; y <-1
     + xx <- xx & gacVSadj(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,5), V=V, type)
     +
     + x <- c(3,9); y <- 1
     + xx <- xx & gacVSadj(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,5), V=V, type)
     +
     + m3 <- pag.m[["m3"]]
     + V <- colnames(m3)
     + x <- 1; y <- 9
     + xx <- xx & gacVSadj(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(5,7), V=V, type)
     +
     + x <- 1; y <- 8
     + xx <- xx & gacVSadj(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(5,9), V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSadj.")
     + } else {
     + message("OK, no issues were found.")
     + }
     +
     + ##################################################
     + ## given same graph, type=cpdag and type=pdag
     + ## should give same canonical set
     + ##################################################
     + m <- rbind(c(0,1,0,0,0,0),
     + c(1,0,1,0,0,0),
     + c(0,1,0,0,0,0),
     + c(0,0,0,0,0,0),
     + c(0,1,1,1,0,0),
     + c(1,0,1,1,1,0))
     + colnames(m) <- rownames(m) <- as.character(1:6)
     +
     + ## You can see that the current adjustment function outputs different sets
     + ## if type = "cpdag" or type = "pdag" which shouldn't happen
     + ## because it is the same graph:
     + res1 <- adjustment(m,amat.type="cpdag",2,4,set.type="canonical")
     + res2 <- adjustment(m,amat.type="pdag",2,4,set.type="canonical")
     +
     + if (!all.equal(res1, res2)) {
     + stop("Canonical set is not the same for type=cpdag and type=pdag\n")
     + }
     +
     + }
     +
     + }
     Loading required namespace: dagitty
    
    
     #
     # Fatal error in , line 0
     # Failed to create ICU collator, are ICU data files missing?
     #
     #
     #
     #FailureMessage Object: 0x7ffdd6e61440
     ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7fea1145b45a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7fea109e38b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7fea11456f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7fea11138413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7fea1125d4a2]
     [0x13d86c1dc0d8]
    
     *** caught illegal operation ***
     address 0x7fea108219a5, cause 'illegal operand'
    
     Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
     10: pcalg2dagitty(amat = amat, labels = lb, type = amat.type)
     11: adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     An irrecoverable exception occurred. R is aborting now ...
    Running the tests in ‘tests/test_pcalg2dagitty.R’ failed.
    Complete output:
     > ## Translate amat as describes in amatType to dagitty object
     > if(requireNamespace("dagitty")) {
     + library(pcalg)
     + library(dagitty)
     + suppressWarnings(RNGversion("3.5.0"))
     + doExtras <- pcalg:::doExtras()
     +
     + res <- rep(FALSE, 10)
     + ####################
     + ## Test DAG 1
     + ####################
     + data(gmG)
     + n <- nrow (gmG8$x)
     + V <- colnames(gmG8$x) # labels aka node names
     +
     + amat <- wgtMatrix(gmG8$g)
     + amat[amat != 0] <- 1
     + dagitty_dag1 <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(gmG8$g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dag1))
     +
     + res[1] <- (dagitty_dag1 == "dag {\nAuthor\nBar\nCtrl\nGoal\nV5\nV6\nV7\nV8\nAuthor -> Bar\nAuthor -> V6\nAuthor -> V8\nBar -> Ctrl\nBar -> V5\nV5 -> V6\nV5 -> V8\nV6 -> V7\n}\n")
     +
     + #############
     + ## Test DAG 2
     + #############
     + set.seed(123)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- pcalg::randomDAG(p,prob=0.3, V = V)
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_dag2 <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dag2))
     +
     + res[2] <- (dagitty_dag2 == "dag {\nA\nH\nJ\nK\nQ\nT\nU\nW\nX\nZ\nA -> Q\nH -> A\nH -> K\nH -> Q\nH -> T\nH -> Z\nJ -> W\nT -> A\nT -> Q\nT -> X\nU -> Q\nU -> W\nU -> X\nW -> K\n}\n")
     +
     + ###############
     + ## Test CPDAG 1
     + ###############
     + data(gmG)
     + n <- nrow(gmG8$ x)
     + V <- colnames(gmG8$ x) # labels aka node names
     +
     + ## estimate CPDAG
     + pc.fit <- pc(suffStat = list(C = cor(gmG8$x), n = n),
     + indepTest = gaussCItest, ## indep.test: partial correlations
     + alpha=0.01, labels = V, verbose = FALSE)
     + amat <- as(pc.fit, "amat")
     + dagitty_cpdag1 <- pcalg2dagitty(amat,V,type="cpdag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow = c(1,2))
     + ## plot(pc.fit)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag1))
     +
     + res[3] <- (dagitty_cpdag1 == "pdag {\nAuthor\nBar\nCtrl\nGoal\nV5\nV6\nV7\nV8\nAuthor -- Bar\nAuthor -> V6\nAuthor -> V8\nBar -- Ctrl\nBar -> V5\nV5 -> V6\nV5 -> V8\nV6 -> V7\n}\n")
     +
     + stopifnot(all(res[1:3]))
     +
     + if (doExtras) {
     + #############
     + ## Test CPDAG 2
     + #############
     + set.seed(135)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- dag2cpdag(pcalg::randomDAG(p,prob=0.3, V = V))
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_cpdag2 <- pcalg2dagitty(amat,V,type="cpdag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag2))
     +
     + res[4] <- (dagitty_cpdag2 == "pdag {\nA\nB\nH\nI\nJ\nK\nO\nS\nV\nX\nA -- I\nA -- J\nA -- V\nA -> B\nA -> O\nH -- I\nH -> B\nI -> B\nJ -- K\nK -> B\nS -- X\nS -> O\nV -> B\n}\n")
     +
     + #############
     + ## Test MAG 1
     + #############
     + amat <- matrix(c(0,2,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- LETTERS[1:4]
     + colnames(amat) <- rownames(amat) <- V
     + ## plotAG(amat)
     + dagitty_mag1 <- pcalg2dagitty(amat,V,type="mag")
     + res[5] <- (dagitty_mag1 == "mag {\nA\nB\nC\nD\nA <-> B\nB -> C\nB -> D\nC -> D\n}\n")
     +
     + #############
     + ## Test MAG 2
     + #############
     + set.seed(78)
     + p <- 8
     + g <- pcalg::randomDAG(p, prob = 0.4)
     + ## Compute the true covariance and then correlation matrix of g:
     + true.corr <- cov2cor(trueCov(g))
     +
     + ## define nodes 2 and 6 to be latent variables
     + L <- c(2,6)
     +
     + ## Find PAG
     + ## As dependence "oracle", we use the true correlation matrix in
     + ## gaussCItest() with a large "virtual sample size" and a large alpha:
     + true.pag <- dag2pag(suffStat = list(C= true.corr, n= 10^9),
     + indepTest= gaussCItest, graph=g, L=L, alpha= 0.9999)
     +
     + ## find a valid MAG such that no additional edges are directed into
     + (amat <- pag2magAM(true.pag@amat, 4)) # -> the adj.matrix of the MAG
     + ## plotAG(amat)
     + V <- colnames(amat)
     + dagitty_mag2 <- pcalg2dagitty(amat,V,type="mag")
     + res[6] <- (dagitty_mag2 == "mag {\n1\n2\n3\n4\n5\n6\n1 -> 4\n1 -> 5\n1 -> 6\n2 -> 5\n3 -> 4\n3 -> 6\n4 -> 5\n4 -> 6\n5 <-> 6\n}\n")
     +
     + #############
     + ## Test PAG 1
     + #############
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- c("V1", "V2", "X", "Y", "V4", "V3")
     + colnames(mFig4b) <- rownames(mFig4b) <- V
     + ## plotAG(mFig4b)
     +
     + dagitty_pag1 <- pcalg2dagitty(mFig4b,V,type="pag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag2))
     +
     + res[7] <- (dagitty_pag1 == "pag {\nV1\nV2\nV3\nV4\nX\nY\nV1 @-> X\nV2 @-> X\nV3 -> Y\nV3 <-> V4\nV3 <-> X\nV4 -> Y\nX -> V4\n}\n")
     +
     + #############
     + ## Test PAG 2
     + #############
     + set.seed(42)
     + p <- 7
     + ## generate and draw random DAG :
     + myDAG <- pcalg::randomDAG(p, prob = 0.4)
     +
     + ## find skeleton and PAG using the FCI algorithm
     + suffStat <- list(C = cov2cor(trueCov(myDAG)), n = 10^9)
     + fm <- fci(suffStat, indepTest=gaussCItest,
     + alpha = 0.9999, p=p, doPdsep = FALSE)
     +
     + amat <- as(fm, "amat")
     + V <- colnames(amat)
     + dagitty_pag2 <- pcalg2dagitty(amat,V,type="pag")
     +
     + res[8] <- (dagitty_pag2 == "pag {\n1\n2\n3\n4\n5\n6\n7\n1 -> 7\n1 @-> 5\n1 @-> 6\n1 @-@ 3\n2 -> 7\n2 @-> 5\n2 @-> 6\n3 -> 7\n3 @-> 5\n3 @-> 6\n3 @-@ 4\n4 @-> 6\n5 @-> 7\n6 -> 7\n}\n")
     +
     + #################
     + ## Test empty DAG
     + #################
     + set.seed(123)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- pcalg::randomDAG(p,prob=0, V = V)
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_dagE <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dagE))
     +
     + res[9] <- (dagitty_dagE == "dag {\nA\nH\nJ\nK\nQ\nT\nU\nW\nX\nZ\n\n}\n")
     +
     + #################
     + ## Test empty PAG
     + #################
     + set.seed(42)
     + p <- 7
     + ## generate and draw random DAG :
     + myDAG <- pcalg::randomDAG(p, prob = 0)
     +
     + ## find skeleton and PAG using the FCI algorithm
     + suffStat <- list(C = cov2cor(trueCov(myDAG)), n = 10^9)
     + fm <- fci(suffStat, indepTest=gaussCItest,
     + alpha = 0.9999, p=p, doPdsep = FALSE)
     +
     + amat <- as(fm, "amat")
     + V <- colnames(amat)
     + dagitty_pagE <- pcalg2dagitty(amat,V,type="pag")
     +
     + res[10] <- (dagitty_pagE == "pag {\n1\n2\n3\n4\n5\n6\n7\n\n}\n")
     +
     + stopifnot(all(res))
     +
     + ########################################################
     + ## Test via comparison of gac() and isAdjustmentSet() ##
     + ########################################################
     + gacVSdagitty <- function(amat, x, y ,z, V, type) {
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     +
     + dgRes <- pcalg2dagitty(amat, V, type = typeDG)
     + Exp <- V[x]; Out <- V[y]; Z <- V[z]
     + gacRes <- gac(amat,x,y, z, type)$gac
     + dgRes <- dagitty::isAdjustmentSet(x = dgRes, Z = Z, exposure = Exp, outcome = Out)
     + (gacRes == dgRes)
     + }
     +
     + ## CPDAG 1: Paper Fig 1
     + ## mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + ## 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + ## V <- as.character(1:nrow(mFig1))
     + ## colnames(mFig1) <- rownames(mFig1) <- V
     +
     + ## typeGAC <- "cpdag"
     + ## x <- 3; y <- 6
     + ## z <- c(2,4); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,5); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,5,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,5); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,5,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- 2; gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- NULL; gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     +
     + xx <- TRUE
     + ##################################################
     + ## DAG / CPDAG
     + ##################################################
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z= NULL, V=V, type)
     +
     + ## CPDAG 2: Paper Fig 5a
     + mFig5a <- matrix(c(0,1,0,0,0, 1,0,1,0,0, 0,0,0,0,1, 0,0,1,0,0, 0,0,0,0,0), 5,5)
     + V <- as.character(1:ncol(mFig5a))
     + rownames(mFig5a) <- colnames(mFig5a) <- V
     +
     + type <- "cpdag"
     + x <- c(1,5); y <- 4
     + xx <- xx & gacVSdagitty(mFig5a, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5a, x,y, z= 2, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z=c(4,5), V=V, type)
     +
     + ## DAG 2 from Marloes' Talk
     + mMMd2 <- matrix(c(0,1,0,1,0,0, 0,0,0,0,0,0, 0,1,0,0,1,0,
     + 0,0,0,0,1,0, 0,0,0,0,0,1, 0,0,0,0,0,0), 6,6)
     + V <- as.character(1:ncol(mMMd2))
     + rownames(mMMd2) <- colnames(mMMd2) <- V
     +
     + type <- "dag"
     + x <- 4; y <- 6
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,5), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,2), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 2, V=V, type)
     +
     + ##################################################
     + ## PAG
     + ##################################################
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSdagitty(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3b <- matrix(c(0,2,0,0, 3,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3b))
     + rownames(mFig3b) <- colnames(mFig3b) <- V
     + xx <- xx & gacVSdagitty(mFig3b, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3c <- matrix(c(0,3,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3c))
     + rownames(mFig3c) <- colnames(mFig3c) <- V
     + xx <- xx & gacVSdagitty(mFig3c, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig4a <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,3,3,2,
     + 0,0,2,0,2,2, 0,0,2,1,0,2, 0,0,1,3,3,0), 6,6)
     + V <- as.character(1:ncol(mFig4a))
     + rownames(mFig4a) <- colnames(mFig4a) <- V
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(1,6), V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(2,6), V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(1,2,6), V=V, type)
     +
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- as.character(1:ncol(mFig4b))
     + rownames(mFig4b) <- colnames(mFig4b) <- V
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z=c(5,6), V=V, type)
     +
     + mFig5b <- matrix(c(0,1,0,0,0,0,0, 2,0,2,3,0,3,0, 0,1,0,0,0,0,0, 0,2,0,0,3,0,0,
     + 0,0,0,2,0,2,3, 0,2,0,0,2,0,0, 0,0,0,0,2,0,0), 7,7)
     + V <- as.character(1:ncol(mFig5b))
     + rownames(mFig5b) <- colnames(mFig5b) <- V
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5,3), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(1,3,4,5), V=V, type)
     +
     + ## PAG in Marloes' talk
     + mMMp <- matrix(c(0,0,0,3,2,0,0, 0,0,0,0,1,0,0, 0,0,0,0,1,0,0, 2,0,0,0,0,3,2,
     + 3,2,2,0,0,0,3, 0,0,0,2,0,0,0, 0,0,0,2,2,0,0), 7,7)
     + V <- as.character(1:ncol(mMMp))
     + rownames(mMMp) <- colnames(mMMp) <- V
     +
     + x <- c(5,6); y <- 7
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,2), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,2,3), V=V, type)
     +
     + ##################################################
     + ## V=V, type = "pag" -- Tests from Ema
     + ##################################################
     + type <- "pag"
     + pag.m <- readRDS(system.file("external/gac-pags.rds", package="pcalg"))
     + m1 <- pag.m[["m1"]]
     + V <- colnames(m1)
     + x <- 6; y <- 9
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,7,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,7,8), V=V, type)
     +
     + x <- c(6,8); y <- 9
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,4), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,7), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,7), V=V, type)
     +
     + x <- 3; y <- 1
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=6, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,6), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,7,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,5,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,5,7,8), V=V, type)
     +
     + m2 <- pag.m[["m2"]]
     + V <- colnames(m2)
     + x <- 3; y <-1
     + xx <- xx & gacVSdagitty(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,5), V=V, type)
     +
     + x <- c(3,9); y <- 1
     + xx <- xx & gacVSdagitty(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,5), V=V, type)
     +
     + m3 <- pag.m[["m3"]]
     + V <- colnames(m3)
     + x <- 1; y <- 9
     + xx <- xx & gacVSdagitty(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(5,7), V=V, type)
     +
     + x <- 1; y <- 8
     + xx <- xx & gacVSdagitty(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(5,9), V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSdagitty.")
     + } else {
     + message("OK, no issues were found.")
     + }
     + }
     + }
     Loading required namespace: dagitty
    
     Attaching package: 'dagitty'
    
     The following object is masked from 'package:pcalg':
    
     randomDAG
    
    
    
     #
     # Fatal error in , line 0
     # Failed to create ICU collator, are ICU data files missing?
     #
     #
     #
     #FailureMessage Object: 0x7fff85bfb2b0
     ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7ff713dca45a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7ff7133528b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7ff713dc5f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7ff713aa7413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7ff713bcc4a2]
     [0x12796445c0d8]
    
     *** caught illegal operation ***
     address 0x7ff7131909a5, cause 'illegal operand'
    
     Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
     10: pcalg2dagitty(amat, V, type = "cpdag")
     An irrecoverable exception occurred. R is aborting now ...
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 2.6-8
Check: examples
Result: ERROR
    Running examples in ‘pcalg-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: adjustment
    > ### Title: Compute adjustment sets for covariate adjustment.
    > ### Aliases: adjustment
    > ### Keywords: models graphs
    >
    > ### ** Examples
    >
    > ## Example 4.1 in Perkovic et. al (2015), Example 2 in Perkovic et. al (2017)
    > mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
    + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
    > type <- "cpdag"
    > x <- 3; y <- 6
    > ## plot(as(t(mFig1), "graphNEL"))
    >
    > ## all
    > if(requireNamespace("dagitty")) {
    + adjustment(amat = mFig1, amat.type = type, x = x, y = y, set.type =
    + "all")
    + }
    Loading required namespace: dagitty
    
    
    #
    # Fatal error in , line 0
    # Failed to create ICU collator, are ICU data files missing?
    #
    #
    #
    #FailureMessage Object: 0x7ffe2a4c0830
    ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7f055432e45a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7f05538b68b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7f0554329f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7f055400b413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7f05541304a2]
     [0x2722ddddc0d8]
    
     *** caught illegal operation ***
    address 0x7f05536f49a5, cause 'illegal operand'
    
    Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
    10: pcalg2dagitty(amat = amat, labels = lb, type = amat.type)
    11: adjustment(amat = mFig1, amat.type = type, x = x, y = y, set.type = "all")
    An irrecoverable exception occurred. R is aborting now ...
Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 2.6-8
Check: tests
Result: ERROR
     Running ‘test_LINGAM.R’
     Running ‘test_addBgKnowledge.R’
     Running ‘test_adjustment.R’
     Running ‘test_ages.R’
     Running ‘test_amat2dag.R’
     Running ‘test_arges.R’
     Running ‘test_backdoor.R’
     Comparing ‘test_backdoor.Rout’ to ‘test_backdoor.Rout.save’ ... OK
     Running ‘test_bicscore.R’
     Running ‘test_causalEffect.R’
     Running ‘test_coercion.R’
     Running ‘test_compareGraphs.R’
     Running ‘test_dag2cpdag.R’
     Running ‘test_dag2essgraph.R’
     Running ‘test_displayAmat.R’
     Running ‘test_dsep.R’
     Running ‘test_fci.R’
     Running ‘test_fciPlus.R’
     Running ‘test_gSquareBin.R’
     Running ‘test_gSquareDis.R’
     Running ‘test_gac.R’
     Running ‘test_getNextSet.R’
     Running ‘test_gies.R’
     Running ‘test_ida.R’ [84s/94s]
     Running ‘test_idaFast.R’
     Running ‘test_isValidGraph.R’
     Running ‘test_jointIda.R’
     Running ‘test_mat2targets.R’
     Running ‘test_optAdjSet.R’
     Running ‘test_opttarget.R’
     Running ‘test_pc.R’
     Running ‘test_pcSelect.R’
     Running ‘test_pcalg2dagitty.R’
     Running ‘test_pcorOrder.R’
     Running ‘test_pdag2allDags.R’
     Running ‘test_pdag2dag.R’
     Running ‘test_possDeAn.R’
     Running ‘test_randDAG.R’
     Comparing ‘test_randDAG.Rout’ to ‘test_randDAG.Rout.save’ ... OK
     Running ‘test_randomDAG.R’
     Running ‘test_rfci.R’
     Running ‘test_rmvDAG.R’
     Running ‘test_shd.R’
     Running ‘test_skeleton.R’
     Running ‘test_udag2pag.R’
     Running ‘test_udag2pdag.R’
     Running ‘test_wgtMatrix.R’
    Running the tests in ‘tests/test_adjustment.R’ failed.
    Complete output:
     > if(requireNamespace("dagitty")) {
     + library(pcalg)
     + (doExtras <- pcalg:::doExtras())
     +
     + ## Minimalistic CRAN checks
     +
     + ## Test 1 ############################
     + ## Test that "no adjustment set" and "empty adjustment set" are distinguished properly
     + x <- 1; y <- 2
     + cpdag <- matrix(c(0,1,1,0),2,2) ## 1 --- 2 => no adj set
     + dag <- matrix(c(0,1,0,0),2,2) ## 1 --> 2 => empty adj set
     +
     + adjC <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     + adjD <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "canonical")
     + adjP <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "canonical")
     +
     + stopifnot(!identical(adjC, adjD), identical(adjD, adjP) )
     +
     + ## Test 2 ###############################
     + gacVSadj <- function(amat, x, y ,z, V, type) {
     + ## gac(z) is TRUE IFF z is returned by adjustment()
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     + gacRes <- gac(amat,x,y, z, type)$gac
     + adjRes <- adjustment(amat = amat, amat.type = typeDG, x = x, y = y, set.type = "all")
     + if (gacRes) { ## z is valid adj set
     + res <- any(sapply(adjRes, function(xx) setequal(z, xx)))
     + } else { ## z is not valid adj set
     + res <- all(!sapply(adjRes, function(xx) setequal(z, xx)))
     + }
     + res
     + }
     +
     + xx <- TRUE
     +
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5), V=V, type)
     +
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSadj(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSadj(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 2, V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSadj.")
     + } else {
     + message("OK, no issues were found.")
     + }
     +
     + ############################################################
     + ## Extensive checks
     + ############################################################
     + if (doExtras) {
     +
     + ## Test that "no adjustment set" and "empty adjustment set" are distinguished properly
     + x <- 1; y <- 2
     + cpdag <- matrix(c(0,1,1,0),2,2) ## 1 --- 2 => no adj set
     + dag <- matrix(c(0,1,0,0),2,2) ## 1 --> 2 => empty adj set
     +
     + adjC <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     + adjD <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "canonical")
     + adjP <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "canonical")
     +
     + stopifnot(!identical(adjC, adjD), identical(adjD, adjP) )
     +
     + adjCAll <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "all")
     + adjDAll <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "all")
     + adjPAll <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "all")
     +
     + stopifnot( !identical(adjCAll, adjDAll), identical(adjDAll, adjPAll) )
     +
     + adjCMin <- adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "minimal")
     + adjDMin <- adjustment(amat = dag, amat.type = "dag", x = 1, y = 2, set.type = "minimal")
     + adjPMin <- adjustment(amat = dag, amat.type = "pdag", x = 1, y = 2, set.type = "minimal")
     +
     + stopifnot( !identical(adjCMin, adjDMin), identical(adjDMin, adjPMin) )
     +
     +
     + #####################################################################################
     + ## Test 1: Compare CPDAG and PDAG implementation and validate all sets using gac()
     + #####################################################################################
     + nreps <- 100
     + simRes <- data.frame(setType = rep(NA, nreps), id = rep(NA,nreps),
     + rtCPDAG = rep(NA,nreps), rtPDAG = rep(NA, nreps),
     + nSet = rep(NA, nreps), gacCheck = rep(NA, nreps))
     + proc.time()
     + for (i in 1:nreps) {
     + cat("i = ",i,"\n")
     + ## generate a graph
     + seed <- i
     + set.seed(seed)
     + p <- sample(x=5:10, size = 1)
     + prob <- sample(x=3:7/10, size = 1)
     + g <- pcalg:::randomDAG(p, prob) ## true DAG
     + cpdag <- dag2cpdag(g)
     + cpdag.mat <- t(as(cpdag,"matrix")) ## has correct encoding
     +
     + ## define input
     + amat <- cpdag.mat
     + x <- sample(x = 1:p, size = 1)
     + y <- sample(x = setdiff(1:p,x), size = 1)
     + set.type <- sample(x = c("all", "minimal"), size = 1)
     + simRes$setType[i] <- set.type
     +
     + ## run both methods
     + simRes$rtCPDAG[i] <- system.time(res1 <- adjustment(amat = amat, amat.type = "cpdag", x = x, y = y, set.type = set.type))[3]
     + simRes$rtPDAG[i] <- system.time(res2 <- adjustment(amat = amat, amat.type = "pdag", x = x, y = y, set.type = set.type))[3]
     + simRes$nSet[i] <- length(res1)
     +
     + if (length(res1) == 0) {
     + res1 <- vector("list", 0)
     + }
     + if (length(res2) == 0) {
     + res2 <- vector("list", 0)
     + }
     + ## compare results
     + simRes$id[i] <- identical(res1,res2)
     +
     + ## compare results with gac() based on "pdag"
     + if (length(res2) > 0) {
     + gc <- TRUE
     + for (j in 1:length(res2)) {
     + gc <- gc & gac(amat = amat, x = x, y = y, z = res2[[j]], type = "cpdag")$gac
     + }
     + simRes$gacCheck[i] <- gc
     + }
     +
     + }
     + proc.time()
     +
     + summary(simRes)
     + table(is.na(simRes$gacCheck), simRes$nSet == 0)
     +
     + ################################################
     + ## Test 2: Check using predefined graphs
     + ################################################
     + gacVSadj <- function(amat, x, y ,z, V, type) {
     + ## gac(z) is TRUE IFF z is returned by adjustment()
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     + gacRes <- gac(amat,x,y, z, type)$gac
     + adjRes <- adjustment(amat = amat, amat.type = typeDG, x = x, y = y, set.type = "all")
     + if (gacRes) { ## z is valid adj set
     + res <- any(sapply(adjRes, function(xx) setequal(z, xx)))
     + } else { ## z is not valid adj set
     + res <- all(!sapply(adjRes, function(xx) setequal(z, xx)))
     + }
     + res
     + }
     +
     + xx <- TRUE
     + ##################################################
     + ## DAG / CPDAG
     + ##################################################
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,5), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z=c(4,2,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mFig1,x,y, z= NULL, V=V, type)
     +
     + ## CPDAG 2: Paper Fig 5a
     + mFig5a <- matrix(c(0,1,0,0,0, 1,0,1,0,0, 0,0,0,0,1, 0,0,1,0,0, 0,0,0,0,0), 5,5)
     + V <- as.character(1:ncol(mFig5a))
     + rownames(mFig5a) <- colnames(mFig5a) <- V
     +
     + type <- "cpdag"
     + x <- c(1,5); y <- 4
     + xx <- xx & gacVSadj(mFig5a, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(mFig5a, x,y, z= 2, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSadj(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mMMd1, x,y, z=c(4,5), V=V, type)
     +
     + ## DAG 2 from Marloes' Talk
     + mMMd2 <- matrix(c(0,1,0,1,0,0, 0,0,0,0,0,0, 0,1,0,0,1,0,
     + 0,0,0,0,1,0, 0,0,0,0,0,1, 0,0,0,0,0,0), 6,6)
     + V <- as.character(1:ncol(mMMd2))
     + rownames(mMMd2) <- colnames(mMMd2) <- V
     +
     + type <- "dag"
     + x <- 4; y <- 6
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,5), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,2), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z=c(1,3), V=V, type)
     + xx <- xx & gacVSadj(mMMd2, x,y, z= 2, V=V, type)
     +
     + ##################################################
     + ## PAG
     + ##################################################
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSadj(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3b <- matrix(c(0,2,0,0, 3,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3b))
     + rownames(mFig3b) <- colnames(mFig3b) <- V
     + xx <- xx & gacVSadj(mFig3b, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3c <- matrix(c(0,3,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3c))
     + rownames(mFig3c) <- colnames(mFig3c) <- V
     + xx <- xx & gacVSadj(mFig3c, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig4a <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,3,3,2,
     + 0,0,2,0,2,2, 0,0,2,1,0,2, 0,0,1,3,3,0), 6,6)
     + V <- as.character(1:ncol(mFig4a))
     + rownames(mFig4a) <- colnames(mFig4a) <- V
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(1,6), V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(2,6), V=V, type)
     + xx <- xx & gacVSadj(mFig4a, x=3, y=4, z=c(1,2,6), V=V, type)
     +
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- as.character(1:ncol(mFig4b))
     + rownames(mFig4b) <- colnames(mFig4b) <- V
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSadj(mFig4b, x=3, y=4, z=c(5,6), V=V, type)
     +
     + mFig5b <- matrix(c(0,1,0,0,0,0,0, 2,0,2,3,0,3,0, 0,1,0,0,0,0,0, 0,2,0,0,3,0,0,
     + 0,0,0,2,0,2,3, 0,2,0,0,2,0,0, 0,0,0,0,2,0,0), 7,7)
     + V <- as.character(1:ncol(mFig5b))
     + rownames(mFig5b) <- colnames(mFig5b) <- V
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(4,5,3), V=V, type)
     + xx <- xx & gacVSadj(mFig5b, x=c(2,7), y=6, z=c(1,3,4,5), V=V, type)
     +
     + ## PAG in Marloes' talk
     + mMMp <- matrix(c(0,0,0,3,2,0,0, 0,0,0,0,1,0,0, 0,0,0,0,1,0,0, 2,0,0,0,0,3,2,
     + 3,2,2,0,0,0,3, 0,0,0,2,0,0,0, 0,0,0,2,2,0,0), 7,7)
     + V <- as.character(1:ncol(mMMp))
     + rownames(mMMp) <- colnames(mMMp) <- V
     +
     + x <- c(5,6); y <- 7
     + xx <- xx & gacVSadj(mMMp, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,2), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,3), V=V, type)
     + xx <- xx & gacVSadj(mMMp, x,y, z=c(1,4,2,3), V=V, type)
     +
     + ##################################################
     + ## V=V, type = "pag" -- Tests from Ema
     + ##################################################
     + type <- "pag"
     + pag.m <- readRDS(system.file(package="pcalg", "external", "gac-pags.rds"))
     + m1 <- pag.m[["m1"]]
     + V <- colnames(m1)
     + x <- 6; y <- 9
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,7,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,7,8), V=V, type)
     +
     + x <- c(6,8); y <- 9
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,4), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,7), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,3,5,7), V=V, type)
     +
     + x <- 3; y <- 1
     + xx <- xx & gacVSadj(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=6, V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,6), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,7,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,5,8), V=V, type)
     + xx <- xx & gacVSadj(m1,x,y, z=c(2,5,7,8), V=V, type)
     +
     + m2 <- pag.m[["m2"]]
     + V <- colnames(m2)
     + x <- 3; y <-1
     + xx <- xx & gacVSadj(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,5), V=V, type)
     +
     + x <- c(3,9); y <- 1
     + xx <- xx & gacVSadj(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSadj(m2,x,y, z=c(2,5), V=V, type)
     +
     + m3 <- pag.m[["m3"]]
     + V <- colnames(m3)
     + x <- 1; y <- 9
     + xx <- xx & gacVSadj(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=8, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(5,7), V=V, type)
     +
     + x <- 1; y <- 8
     + xx <- xx & gacVSadj(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=9, V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSadj(m3,x,y, z=c(5,9), V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSadj.")
     + } else {
     + message("OK, no issues were found.")
     + }
     +
     + ##################################################
     + ## given same graph, type=cpdag and type=pdag
     + ## should give same canonical set
     + ##################################################
     + m <- rbind(c(0,1,0,0,0,0),
     + c(1,0,1,0,0,0),
     + c(0,1,0,0,0,0),
     + c(0,0,0,0,0,0),
     + c(0,1,1,1,0,0),
     + c(1,0,1,1,1,0))
     + colnames(m) <- rownames(m) <- as.character(1:6)
     +
     + ## You can see that the current adjustment function outputs different sets
     + ## if type = "cpdag" or type = "pdag" which shouldn't happen
     + ## because it is the same graph:
     + res1 <- adjustment(m,amat.type="cpdag",2,4,set.type="canonical")
     + res2 <- adjustment(m,amat.type="pdag",2,4,set.type="canonical")
     +
     + if (!all.equal(res1, res2)) {
     + stop("Canonical set is not the same for type=cpdag and type=pdag\n")
     + }
     +
     + }
     +
     + }
     Loading required namespace: dagitty
    
    
     #
     # Fatal error in , line 0
     # Failed to create ICU collator, are ICU data files missing?
     #
     #
     #
     #FailureMessage Object: 0x7fffa72525a0
     ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7f3cf091c45a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7f3cefea48b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7f3cf0917f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7f3cf05f9413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7f3cf071e4a2]
     [0x3512e99dc0d8]
    
     *** caught illegal operation ***
     address 0x7f3cefce29a5, cause 'illegal operand'
    
     Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
     10: pcalg2dagitty(amat = amat, labels = lb, type = amat.type)
     11: adjustment(amat = cpdag, amat.type = "cpdag", x = 1, y = 2, set.type = "canonical")
     An irrecoverable exception occurred. R is aborting now ...
    Running the tests in ‘tests/test_pcalg2dagitty.R’ failed.
    Complete output:
     > ## Translate amat as describes in amatType to dagitty object
     > if(requireNamespace("dagitty")) {
     + library(pcalg)
     + library(dagitty)
     + suppressWarnings(RNGversion("3.5.0"))
     + doExtras <- pcalg:::doExtras()
     +
     + res <- rep(FALSE, 10)
     + ####################
     + ## Test DAG 1
     + ####################
     + data(gmG)
     + n <- nrow (gmG8$x)
     + V <- colnames(gmG8$x) # labels aka node names
     +
     + amat <- wgtMatrix(gmG8$g)
     + amat[amat != 0] <- 1
     + dagitty_dag1 <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(gmG8$g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dag1))
     +
     + res[1] <- (dagitty_dag1 == "dag {\nAuthor\nBar\nCtrl\nGoal\nV5\nV6\nV7\nV8\nAuthor -> Bar\nAuthor -> V6\nAuthor -> V8\nBar -> Ctrl\nBar -> V5\nV5 -> V6\nV5 -> V8\nV6 -> V7\n}\n")
     +
     + #############
     + ## Test DAG 2
     + #############
     + set.seed(123)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- pcalg::randomDAG(p,prob=0.3, V = V)
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_dag2 <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dag2))
     +
     + res[2] <- (dagitty_dag2 == "dag {\nA\nH\nJ\nK\nQ\nT\nU\nW\nX\nZ\nA -> Q\nH -> A\nH -> K\nH -> Q\nH -> T\nH -> Z\nJ -> W\nT -> A\nT -> Q\nT -> X\nU -> Q\nU -> W\nU -> X\nW -> K\n}\n")
     +
     + ###############
     + ## Test CPDAG 1
     + ###############
     + data(gmG)
     + n <- nrow(gmG8$ x)
     + V <- colnames(gmG8$ x) # labels aka node names
     +
     + ## estimate CPDAG
     + pc.fit <- pc(suffStat = list(C = cor(gmG8$x), n = n),
     + indepTest = gaussCItest, ## indep.test: partial correlations
     + alpha=0.01, labels = V, verbose = FALSE)
     + amat <- as(pc.fit, "amat")
     + dagitty_cpdag1 <- pcalg2dagitty(amat,V,type="cpdag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow = c(1,2))
     + ## plot(pc.fit)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag1))
     +
     + res[3] <- (dagitty_cpdag1 == "pdag {\nAuthor\nBar\nCtrl\nGoal\nV5\nV6\nV7\nV8\nAuthor -- Bar\nAuthor -> V6\nAuthor -> V8\nBar -- Ctrl\nBar -> V5\nV5 -> V6\nV5 -> V8\nV6 -> V7\n}\n")
     +
     + stopifnot(all(res[1:3]))
     +
     + if (doExtras) {
     + #############
     + ## Test CPDAG 2
     + #############
     + set.seed(135)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- dag2cpdag(pcalg::randomDAG(p,prob=0.3, V = V))
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_cpdag2 <- pcalg2dagitty(amat,V,type="cpdag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag2))
     +
     + res[4] <- (dagitty_cpdag2 == "pdag {\nA\nB\nH\nI\nJ\nK\nO\nS\nV\nX\nA -- I\nA -- J\nA -- V\nA -> B\nA -> O\nH -- I\nH -> B\nI -> B\nJ -- K\nK -> B\nS -- X\nS -> O\nV -> B\n}\n")
     +
     + #############
     + ## Test MAG 1
     + #############
     + amat <- matrix(c(0,2,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- LETTERS[1:4]
     + colnames(amat) <- rownames(amat) <- V
     + ## plotAG(amat)
     + dagitty_mag1 <- pcalg2dagitty(amat,V,type="mag")
     + res[5] <- (dagitty_mag1 == "mag {\nA\nB\nC\nD\nA <-> B\nB -> C\nB -> D\nC -> D\n}\n")
     +
     + #############
     + ## Test MAG 2
     + #############
     + set.seed(78)
     + p <- 8
     + g <- pcalg::randomDAG(p, prob = 0.4)
     + ## Compute the true covariance and then correlation matrix of g:
     + true.corr <- cov2cor(trueCov(g))
     +
     + ## define nodes 2 and 6 to be latent variables
     + L <- c(2,6)
     +
     + ## Find PAG
     + ## As dependence "oracle", we use the true correlation matrix in
     + ## gaussCItest() with a large "virtual sample size" and a large alpha:
     + true.pag <- dag2pag(suffStat = list(C= true.corr, n= 10^9),
     + indepTest= gaussCItest, graph=g, L=L, alpha= 0.9999)
     +
     + ## find a valid MAG such that no additional edges are directed into
     + (amat <- pag2magAM(true.pag@amat, 4)) # -> the adj.matrix of the MAG
     + ## plotAG(amat)
     + V <- colnames(amat)
     + dagitty_mag2 <- pcalg2dagitty(amat,V,type="mag")
     + res[6] <- (dagitty_mag2 == "mag {\n1\n2\n3\n4\n5\n6\n1 -> 4\n1 -> 5\n1 -> 6\n2 -> 5\n3 -> 4\n3 -> 6\n4 -> 5\n4 -> 6\n5 <-> 6\n}\n")
     +
     + #############
     + ## Test PAG 1
     + #############
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- c("V1", "V2", "X", "Y", "V4", "V3")
     + colnames(mFig4b) <- rownames(mFig4b) <- V
     + ## plotAG(mFig4b)
     +
     + dagitty_pag1 <- pcalg2dagitty(mFig4b,V,type="pag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g)
     + ## plot(dagitty:::graphLayout(dagitty_cpdag2))
     +
     + res[7] <- (dagitty_pag1 == "pag {\nV1\nV2\nV3\nV4\nX\nY\nV1 @-> X\nV2 @-> X\nV3 -> Y\nV3 <-> V4\nV3 <-> X\nV4 -> Y\nX -> V4\n}\n")
     +
     + #############
     + ## Test PAG 2
     + #############
     + set.seed(42)
     + p <- 7
     + ## generate and draw random DAG :
     + myDAG <- pcalg::randomDAG(p, prob = 0.4)
     +
     + ## find skeleton and PAG using the FCI algorithm
     + suffStat <- list(C = cov2cor(trueCov(myDAG)), n = 10^9)
     + fm <- fci(suffStat, indepTest=gaussCItest,
     + alpha = 0.9999, p=p, doPdsep = FALSE)
     +
     + amat <- as(fm, "amat")
     + V <- colnames(amat)
     + dagitty_pag2 <- pcalg2dagitty(amat,V,type="pag")
     +
     + res[8] <- (dagitty_pag2 == "pag {\n1\n2\n3\n4\n5\n6\n7\n1 -> 7\n1 @-> 5\n1 @-> 6\n1 @-@ 3\n2 -> 7\n2 @-> 5\n2 @-> 6\n3 -> 7\n3 @-> 5\n3 @-> 6\n3 @-@ 4\n4 @-> 6\n5 @-> 7\n6 -> 7\n}\n")
     +
     + #################
     + ## Test empty DAG
     + #################
     + set.seed(123)
     + p <- 10
     + V <- sample(LETTERS, p)
     + g <- pcalg::randomDAG(p,prob=0, V = V)
     +
     + amat <- wgtMatrix(g)
     + amat[amat != 0] <- 1
     + dagitty_dagE <- pcalg2dagitty(amat,V,type="dag")
     + ## Use dagitty:::graphLayout instead of just graphLayout
     + ## because Rgraphviz package that R uses has a function w the same name
     + ## par(mfrow=c(1,2))
     + ## plot(g, main = "True DAG")
     + ## plot(dagitty:::graphLayout(dagitty_dagE))
     +
     + res[9] <- (dagitty_dagE == "dag {\nA\nH\nJ\nK\nQ\nT\nU\nW\nX\nZ\n\n}\n")
     +
     + #################
     + ## Test empty PAG
     + #################
     + set.seed(42)
     + p <- 7
     + ## generate and draw random DAG :
     + myDAG <- pcalg::randomDAG(p, prob = 0)
     +
     + ## find skeleton and PAG using the FCI algorithm
     + suffStat <- list(C = cov2cor(trueCov(myDAG)), n = 10^9)
     + fm <- fci(suffStat, indepTest=gaussCItest,
     + alpha = 0.9999, p=p, doPdsep = FALSE)
     +
     + amat <- as(fm, "amat")
     + V <- colnames(amat)
     + dagitty_pagE <- pcalg2dagitty(amat,V,type="pag")
     +
     + res[10] <- (dagitty_pagE == "pag {\n1\n2\n3\n4\n5\n6\n7\n\n}\n")
     +
     + stopifnot(all(res))
     +
     + ########################################################
     + ## Test via comparison of gac() and isAdjustmentSet() ##
     + ########################################################
     + gacVSdagitty <- function(amat, x, y ,z, V, type) {
     + ## x,y,z: col positions as used in GAC
     + ## Result: TRUE is result is equal
     + typeDG <- switch(type,
     + dag = "dag",
     + cpdag = "cpdag",
     + mag = "mag",
     + pag = "pag")
     +
     + dgRes <- pcalg2dagitty(amat, V, type = typeDG)
     + Exp <- V[x]; Out <- V[y]; Z <- V[z]
     + gacRes <- gac(amat,x,y, z, type)$gac
     + dgRes <- dagitty::isAdjustmentSet(x = dgRes, Z = Z, exposure = Exp, outcome = Out)
     + (gacRes == dgRes)
     + }
     +
     + ## CPDAG 1: Paper Fig 1
     + ## mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + ## 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + ## V <- as.character(1:nrow(mFig1))
     + ## colnames(mFig1) <- rownames(mFig1) <- V
     +
     + ## typeGAC <- "cpdag"
     + ## x <- 3; y <- 6
     + ## z <- c(2,4); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,5); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,5,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,5); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- c(4,2,5,1); gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- 2; gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     + ## z <- NULL; gacVSdagitty(amat = mFig1, x=x, y=y, z=z, V=V, type=typeGAC)
     +
     + xx <- TRUE
     + ##################################################
     + ## DAG / CPDAG
     + ##################################################
     + ## CPDAG 1: Paper Fig 1
     + mFig1 <- matrix(c(0,1,1,0,0,0, 1,0,1,1,1,0, 0,0,0,0,0,1,
     + 0,1,1,0,1,1, 0,1,0,1,0,1, 0,0,0,0,0,0), 6,6)
     + type <- "cpdag"
     + x <- 3; y <- 6
     +
     + V <- as.character(1:ncol(mFig1))
     + rownames(mFig1) <- colnames(mFig1) <- V
     +
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(2,4), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z=c(4,2,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mFig1,x,y, z= NULL, V=V, type)
     +
     + ## CPDAG 2: Paper Fig 5a
     + mFig5a <- matrix(c(0,1,0,0,0, 1,0,1,0,0, 0,0,0,0,1, 0,0,1,0,0, 0,0,0,0,0), 5,5)
     + V <- as.character(1:ncol(mFig5a))
     + rownames(mFig5a) <- colnames(mFig5a) <- V
     +
     + type <- "cpdag"
     + x <- c(1,5); y <- 4
     + xx <- xx & gacVSdagitty(mFig5a, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5a, x,y, z= 2, V=V, type)
     +
     + ## DAG 1 from Marloes' Talk
     + mMMd1 <- matrix(c(0,1,0,1,0,0, 0,0,1,0,1,0, 0,0,0,0,0,1,
     + 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0),6,6)
     + V <- as.character(1:ncol(mMMd1))
     + rownames(mMMd1) <- colnames(mMMd1) <- V
     +
     + type <- "dag"
     + x <- 1; y <- 3
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd1, x,y, z=c(4,5), V=V, type)
     +
     + ## DAG 2 from Marloes' Talk
     + mMMd2 <- matrix(c(0,1,0,1,0,0, 0,0,0,0,0,0, 0,1,0,0,1,0,
     + 0,0,0,0,1,0, 0,0,0,0,0,1, 0,0,0,0,0,0), 6,6)
     + V <- as.character(1:ncol(mMMd2))
     + rownames(mMMd2) <- colnames(mMMd2) <- V
     +
     + type <- "dag"
     + x <- 4; y <- 6
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 5, V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,5), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,2), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z=c(1,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMd2, x,y, z= 2, V=V, type)
     +
     + ##################################################
     + ## PAG
     + ##################################################
     + type <- "pag"
     + mFig3a <- matrix(c(0,1,0,0, 1,0,1,1, 0,1,0,1, 0,1,1,0), 4,4)
     + V <- as.character(1:ncol(mFig3a))
     + rownames(mFig3a) <- colnames(mFig3a) <- V
     + xx <- xx & gacVSdagitty(mFig3a, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3b <- matrix(c(0,2,0,0, 3,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3b))
     + rownames(mFig3b) <- colnames(mFig3b) <- V
     + xx <- xx & gacVSdagitty(mFig3b, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig3c <- matrix(c(0,3,0,0, 2,0,3,3, 0,2,0,3, 0,2,2,0), 4,4)
     + V <- as.character(1:ncol(mFig3c))
     + rownames(mFig3c) <- colnames(mFig3c) <- V
     + xx <- xx & gacVSdagitty(mFig3c, x=2, y=4, z=NULL, V=V, type)
     +
     + mFig4a <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,3,3,2,
     + 0,0,2,0,2,2, 0,0,2,1,0,2, 0,0,1,3,3,0), 6,6)
     + V <- as.character(1:ncol(mFig4a))
     + rownames(mFig4a) <- colnames(mFig4a) <- V
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(1,6), V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(2,6), V=V, type)
     + xx <- xx & gacVSdagitty(mFig4a, x=3, y=4, z=c(1,2,6), V=V, type)
     +
     + mFig4b <- matrix(c(0,0,1,0,0,0, 0,0,1,0,0,0, 2,2,0,0,3,2,
     + 0,0,0,0,2,2, 0,0,2,3,0,2, 0,0,2,3,2,0), 6,6)
     + V <- as.character(1:ncol(mFig4b))
     + rownames(mFig4b) <- colnames(mFig4b) <- V
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z= 6, V=V, type)
     + xx <- xx & gacVSdagitty(mFig4b, x=3, y=4, z=c(5,6), V=V, type)
     +
     + mFig5b <- matrix(c(0,1,0,0,0,0,0, 2,0,2,3,0,3,0, 0,1,0,0,0,0,0, 0,2,0,0,3,0,0,
     + 0,0,0,2,0,2,3, 0,2,0,0,2,0,0, 0,0,0,0,2,0,0), 7,7)
     + V <- as.character(1:ncol(mFig5b))
     + rownames(mFig5b) <- colnames(mFig5b) <- V
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5,1), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(4,5,3), V=V, type)
     + xx <- xx & gacVSdagitty(mFig5b, x=c(2,7), y=6, z=c(1,3,4,5), V=V, type)
     +
     + ## PAG in Marloes' talk
     + mMMp <- matrix(c(0,0,0,3,2,0,0, 0,0,0,0,1,0,0, 0,0,0,0,1,0,0, 2,0,0,0,0,3,2,
     + 3,2,2,0,0,0,3, 0,0,0,2,0,0,0, 0,0,0,2,2,0,0), 7,7)
     + V <- as.character(1:ncol(mMMp))
     + rownames(mMMp) <- colnames(mMMp) <- V
     +
     + x <- c(5,6); y <- 7
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 1, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 4, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 2, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z= 3, V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,2), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,3), V=V, type)
     + xx <- xx & gacVSdagitty(mMMp, x,y, z=c(1,4,2,3), V=V, type)
     +
     + ##################################################
     + ## V=V, type = "pag" -- Tests from Ema
     + ##################################################
     + type <- "pag"
     + pag.m <- readRDS(system.file("external/gac-pags.rds", package="pcalg"))
     + m1 <- pag.m[["m1"]]
     + V <- colnames(m1)
     + x <- 6; y <- 9
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,7,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,7,8), V=V, type)
     +
     + x <- c(6,8); y <- 9
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=1, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,4), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,7), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,3,5,7), V=V, type)
     +
     + x <- 3; y <- 1
     + xx <- xx & gacVSdagitty(m1,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=6, V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,6), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,7,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,5,8), V=V, type)
     + xx <- xx & gacVSdagitty(m1,x,y, z=c(2,5,7,8), V=V, type)
     +
     + m2 <- pag.m[["m2"]]
     + V <- colnames(m2)
     + x <- 3; y <-1
     + xx <- xx & gacVSdagitty(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,5), V=V, type)
     +
     + x <- c(3,9); y <- 1
     + xx <- xx & gacVSdagitty(m2,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=4, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,8,9), V=V, type)
     + xx <- xx & gacVSdagitty(m2,x,y, z=c(2,5), V=V, type)
     +
     + m3 <- pag.m[["m3"]]
     + V <- colnames(m3)
     + x <- 1; y <- 9
     + xx <- xx & gacVSdagitty(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=8, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(5,7), V=V, type)
     +
     + x <- 1; y <- 8
     + xx <- xx & gacVSdagitty(m3,x,y, z=NULL, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=2, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=3, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=5, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=7, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=9, V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(2,3), V=V, type)
     + xx <- xx & gacVSdagitty(m3,x,y, z=c(5,9), V=V, type)
     +
     + if (!xx) {
     + stop("Problem when testing function gacVSdagitty.")
     + } else {
     + message("OK, no issues were found.")
     + }
     + }
     + }
     Loading required namespace: dagitty
    
     Attaching package: 'dagitty'
    
     The following object is masked from 'package:pcalg':
    
     randomDAG
    
    
    
     #
     # Fatal error in , line 0
     # Failed to create ICU collator, are ICU data files missing?
     #
     #
     #
     #FailureMessage Object: 0x7ffef218d190
     ==== C stack trace ===============================
    
     /lib64/libnode.so.64(v8::base::debug::StackTrace::StackTrace()+0x1a) [0x7f20be19745a]
     /lib64/libnode.so.64(+0x92e8b1) [0x7f20bd71f8b1]
     /lib64/libnode.so.64(V8_Fatal(char const*, int, char const*, ...)+0x177) [0x7f20be192f57]
     /lib64/libnode.so.64(v8::internal::Collator::InitializeCollator(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::JSObject>)+0x473) [0x7f20bde74413]
     /lib64/libnode.so.64(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x192) [0x7f20bdf994a2]
     [0x385b908dc0d8]
    
     *** caught illegal operation ***
     address 0x7f20bd55d9a5, cause 'illegal operand'
    
     Traceback:
     1: context_eval(join(src), private$context)
     2: get_str_output(context_eval(join(src), private$context))
     3: ct$eval(paste("global.", name, "=", value))
     4: .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()"))
     5: doTryCatch(return(expr), name, parentenv, handler)
     6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     7: tryCatchList(expr, classes, parentenv, handlers)
     8: tryCatch({ .jsassign(xv, as.character(x)) .jsassign(xv, .jsp("GraphParser.parseGuess(global.", xv, ").toString()")) r <- structure(.jsget(xv), class = "dagitty")}, error = function(e) { stop(e)}, finally = { .deleteJSVar(xv)})
     9: dagitty::dagitty(result)
     10: pcalg2dagitty(amat, V, type = "cpdag")
     An irrecoverable exception occurred. R is aborting now ...
Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 2.6-8
Check: running examples for arch ‘x64’
Result: ERROR
    Running examples in 'pcalg-Ex.R' failed
    The error most likely occurred in:
    
    > ### Name: idaFast
    > ### Title: Multiset of Possible Total Causal Effects for Several Target
    > ### Var.s
    > ### Aliases: idaFast
    > ### Keywords: multivariate models graphs
    >
    > ### ** Examples
    >
    > ## Simulate the true DAG
    > set.seed(123)
    > p <- 7
    > myDAG <- randomDAG(p, prob = 0.2) ## true DAG
    > myCPDAG <- dag2cpdag(myDAG) ## true CPDAG
    > covTrue <- trueCov(myDAG) ## true covariance matrix
    >
    > ## simulate data from the true DAG
    > n <- 10000
    > dat <- rmvDAG(n, myDAG)
    > cov.d <- cov(dat)
    >
    > ## estimate CPDAG (see help on the function "pc")
    > suffStat <- list(C = cor(dat), n = n)
    > pc.fit <- pc(suffStat, indepTest = gaussCItest, alpha = 0.01, p=p)
    >
    > if(require(Rgraphviz)) {
    + op <- par(mfrow=c(1,3))
    + plot(myDAG, main="true DAG")
    + plot(myCPDAG, main="true CPDAG")
    + plot(pc.fit@graph, main="pc()-estimated CPDAG")
    + par(op)
    + }
    Loading required package: Rgraphviz
    Loading required package: graph
    Loading required package: BiocGenerics
    Loading required package: parallel
    
    Attaching package: 'BiocGenerics'
    
    The following objects are masked from 'package:parallel':
    
     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
     clusterExport, clusterMap, parApply, parCapply, parLapply,
     parLapplyLB, parRapply, parSapply, parSapplyLB
    
    The following objects are masked from 'package:stats':
    
     IQR, mad, sd, var, xtabs
    
    The following objects are masked from 'package:base':
    
     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
     as.data.frame, basename, cbind, colnames, dirname, do.call,
     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
     pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
     tapply, union, unique, unsplit, which, which.max, which.min
    
    Loading required package: grid
    Error in plot.new() : write failed
    Calls: plot ... plot -> .local -> plot -> plot -> .local -> plot.new
    Execution halted
    Error: internal read error in PDF_endpage
    Fatal error: error during cleanup
Flavor: r-devel-windows-ix86+x86_64-gcc8

Version: 2.6-8
Check: running tests for arch ‘i386’
Result: ERROR
     Running 'test_LINGAM.R' [4s]
     Running 'test_addBgKnowledge.R' [3s]
     Running 'test_adjustment.R' [5s]
     Running 'test_ages.R' [3s]
     Running 'test_amat2dag.R' [2s]
     Running 'test_arges.R' [2s]
     Running 'test_backdoor.R' [9s]
     Comparing 'test_backdoor.Rout' to 'test_backdoor.Rout.save' ...
Flavor: r-devel-windows-ix86+x86_64-gcc8

Version: 2.6-8
Check: PDF version of manual
Result: ERROR
    Rd conversion errors:
    Warning in close.connection(con) :
     Problem closing connection: No space left on device
    Error in writeLines(x, con, useBytes = TRUE, ...) :
     Error writing to connection: No space left on device
Flavor: r-devel-windows-ix86+x86_64-gcc8