From a2ab06891d0ad9716a23e520b0ab3858e523f70e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Oct 2024 00:03:17 +0200 Subject: [PATCH] debug orig_var in flip2sss --- R/combine.R | 7 +++---- R/flip2sss.R | 5 +++-- R/join_flipscores.R | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/combine.R b/R/combine.R index c17da6f..bdaa760 100644 --- a/R/combine.R +++ b/R/combine.R @@ -15,9 +15,8 @@ combine <- function (mods, comb_funct = "maxT", combined = NULL, by=NULL, tail = smr=apply(res$summary_table[,by,drop=FALSE],1,paste,collapse="_") if (is.null(combined)) combined=attr(mods$Tspace,"orig_var") - if (is.null(combined)) - combined = list(Overall = 1:ncol(res$Tspace)) - + if (is.null(combined)){ +# combined = list(Overall = 1:ncol(res$Tspace)) uniq_nm = unique(smr) if (length(uniq_nm) %in% c(1,length(smr))) { combined = list(Overall = 1:ncol(res$Tspace)) @@ -26,7 +25,7 @@ combine <- function (mods, comb_funct = "maxT", combined = NULL, by=NULL, tail = combined = lapply(uniq_nm, function(nm) which(smr == nm)) names(combined) = uniq_nm } - + } if (!is.list(combined)) { uniq_nm = combined combined = lapply(uniq_nm, function(nm) which(smr == nm)) diff --git a/R/flip2sss.R b/R/flip2sss.R index c57de80..7bde733 100644 --- a/R/flip2sss.R +++ b/R/flip2sss.R @@ -22,7 +22,8 @@ #'attr(model.matrix(mods[[1]]),"assign") #' @import dplyr #' @import magrittr -#' +#' @author Livio Finos, Angela Andreella +#' flip2sss <- function(formula=NULL, data=NULL, cluster=NULL, @@ -33,7 +34,7 @@ flip2sss <- function(formula=NULL, # cluster=eval(cluster,data) # } - + ################### vars_between = .get_sets_vars_between(formula, data, cluster) diff --git a/R/join_flipscores.R b/R/join_flipscores.R index e5018b3..e0f1515 100644 --- a/R/join_flipscores.R +++ b/R/join_flipscores.R @@ -37,9 +37,9 @@ join_flipscores <- function (mods, tested_coeffs = NULL, n_flips = 5000, score_t if(!is.null(seed)) set.seed(seed) names(mods) = .set_mods_names(mods) - # if (is.null(tested_coeffs)) { - # tested_coeffs = .get_all_coeff_names_list(mods) - # } + if (is.null(tested_coeffs)) { + tested_coeffs = .get_all_coeff_names_list(mods) + } if (!is.list(tested_coeffs)) { temp = .get_all_coeff_names_list(mods) tested_coeffs = lapply(temp, function(nms) intersect(tested_coeffs, @@ -106,11 +106,11 @@ join_flipscores <- function (mods, tested_coeffs = NULL, n_flips = 5000, score_t assign=unlist(assign) names(assign)=NULL - if(!is.null(tested_coeffs)){ - id_tested_coeffs=which(names_vars_orig%in%tested_coeffs) - names_vars_orig=names_vars_orig[names_vars_orig%in%tested_coeffs] - assign=assign[assign%in%id_tested_coeffs] - } + # if(!is.null(tested_coeffs)){ + # id_tested_coeffs=which(names_vars_orig%in%tested_coeffs) + # names_vars_orig=names_vars_orig[names_vars_orig%in%tested_coeffs] + # assign=assign[assign%in%id_tested_coeffs] + # } temp=lapply(unique(assign),function(i) which(assign==i)) names(temp)=names_vars_orig out=list(Tspace=.get_all_Tspace(mods),