Skip to content

Commit

Permalink
debug orig_var in flip2sss
Browse files Browse the repository at this point in the history
  • Loading branch information
livioivil committed Oct 21, 2024
1 parent c117e30 commit a2ab068
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
7 changes: 3 additions & 4 deletions R/combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions R/flip2sss.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -33,7 +34,7 @@ flip2sss <- function(formula=NULL,
# cluster=eval(cluster,data)
# }


###################

vars_between = .get_sets_vars_between(formula, data, cluster)
Expand Down
16 changes: 8 additions & 8 deletions R/join_flipscores.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit a2ab068

Please sign in to comment.