Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/ei_iter.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ei_iter <- function(
}

# Standard to use 1 less core for clusters
clust <- parallel::makeCluster(parallel::detectCores() - 1)
clust <- parallel::makeCluster(parallel::detectCores() - 1, setup_timeout = 0.5)

# Register parallel processing cluster
doSNOW::registerDoSNOW(clust)
Expand Down
4 changes: 1 addition & 3 deletions R/ei_rxc.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ei_rxc <- function(
if (verbose) message("Running in paralllel")

# Standard to use 1 less core for clusters
clust <- parallel::makeCluster(parallel::detectCores() - 1)
clust <- parallel::makeCluster(parallel::detectCores() - 1, setup_timeout = 0.5)

# Register parallel processing cluster
doSNOW::registerDoSNOW(clust)
Expand Down Expand Up @@ -319,8 +319,6 @@ ei_rxc <- function(
}

if (plots) {
# colnames(chains_pr) <- gsub("ccount.", "betas.", colnames(md_out$draws$Cell.counts))
colnames(chains_pr) <- paste0("betas.", colnames(chains_pr))
# Create density plots
density_plots <- overlay_density_plot(chains_pr, results_table,
race_cols, cand_cols,
Expand Down
6 changes: 4 additions & 2 deletions R/overlay_density_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ overlay_density_plot <- function(agg_betas, results_table, race_cols, cand_cols,

# Column titles
colnames(race_comb) <- gsub(paste(race[k], "_", sep = ""), "", colnames(race_comb))
colnames(race_comb) <- gsub(paste("_", race[k], sep = ""), "", colnames(race_comb))

# Set up data to create graphs
dens_data <- reshape2::melt(race_comb, id.vars = NULL)
Expand All @@ -96,9 +97,10 @@ overlay_density_plot <- function(agg_betas, results_table, race_cols, cand_cols,
} else if (ei_type == "rxc") {
dens_data <- as.data.frame(dens_data[, c("Candidate", "value")])

rt_sub <- as.data.frame(results_table[race[k]][[1]])
rt_sub$Candidate <- rownames(rt_sub)
rt_sub <- as.data.frame(results_table[results_table$race == race[k], ])
rt_sub <- dplyr::rename(rt_sub, mean_size = mean)
rt_sub$mean_size <- rt_sub$mean_size * 100
rt_sub <- dplyr::rename(rt_sub, Candidate = cand)
rt_sub <- rt_sub[, c("Candidate", "mean_size")]
}

Expand Down