From ca233fa61582a72188ff6d67aff393aed9534eb1 Mon Sep 17 00:00:00 2001 From: Don van den Bergh Date: Wed, 4 Dec 2024 09:35:44 +0100 Subject: [PATCH] fix test issues (#126) --- R/bayesiannetworkanalysis.R | 2 +- R/networkanalysis.R | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/R/bayesiannetworkanalysis.R b/R/bayesiannetworkanalysis.R index 509a4c0..94e233f 100644 --- a/R/bayesiannetworkanalysis.R +++ b/R/bayesiannetworkanalysis.R @@ -41,7 +41,7 @@ BayesianNetworkAnalysis <- function(jaspResults, dataset, options) { mainContainer <- jaspResults[["mainContainer"]] if (is.null(mainContainer)) { mainContainer <- createJaspContainer(dependencies = c("variables", "groupingVariable", "estimator", - "burnin", "iter", "gprior", "dfprior")) + "burnin", "iter", "gprior", "dfprior", "setSeed", "seed")) jaspResults[["mainContainer"]] <- mainContainer } .bayesianNetworkAnalysisMainTableMeta(mainContainer, dataset, options) diff --git a/R/networkanalysis.R b/R/networkanalysis.R index 814440f..a02aeff 100644 --- a/R/networkanalysis.R +++ b/R/networkanalysis.R @@ -95,8 +95,11 @@ NetworkAnalysis <- function(jaspResults, dataset, options) { # check if data must be binarized if (options[["estimator"]] %in% c("isingFit", "isingSampler")) { - idx <- colnames(dataset) != options[["groupingVariable"]] - dataset[idx] <- bootnet::binarize(dataset[idx], split = options[["split"]], verbose = FALSE, removeNArows = FALSE) + + for (i in seq_along(dataset)) { + idx <- colnames(dataset[[i]]) != options[["groupingVariable"]] + dataset[[i]][idx] <- bootnet::binarize(dataset[[i]][idx], split = options[["split"]], verbose = FALSE, removeNArows = FALSE) + } if (options[["estimator"]] == "isingFit") { # required check since isingFit removes these variables from the analyses