From 7b49e46d48b61dcac859dce99d3ae8d93f7e15f1 Mon Sep 17 00:00:00 2001 From: maltelueken Date: Mon, 10 Jul 2023 11:44:32 +0200 Subject: [PATCH] Add moderated moderation for model number input --- R/classicProcess.R | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/R/classicProcess.R b/R/classicProcess.R index 97e7b51..a98f8c6 100644 --- a/R/classicProcess.R +++ b/R/classicProcess.R @@ -211,18 +211,21 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) { pathVars <- regList[[i]][["vars"]] # Split path interactions - pathVarsSplit <- .strsplitColon(pathVars) - + pathVarsSplit <- strsplit(pathVars, ":|__") # split according to `:` or `__` + isThreeWayInt <- grepl("__", pathVars) + # Replace dummy vars for each term of interactions separately pathVarsSplit <- lapply(pathVarsSplit, .replaceDummyVars) # Paste interaction terms back together - regList[[i]][["vars"]] <- sapply(pathVarsSplit, paste, collapse = ":") + pathVars[!isThreeWayInt] <- unlist(sapply(pathVarsSplit[!isThreeWayInt], paste, collapse = ":")) + pathVars[isThreeWayInt] <- unlist(sapply(pathVarsSplit[isThreeWayInt], paste, collapse = "__")) + regList[[i]][["vars"]] <- pathVars } # Replace dummy variables in dependent variables names(regList) <- .replaceDummyVars(names(regList)) - + return(regList) }