Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a possibility to allow the universal empty set #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
10 changes: 7 additions & 3 deletions R/MainBar.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Counts the frequency of each intersection being looked at and sets up data for main bar plot.
## Also orders the data for the bar plot and matrix plot
Counter <- function(data, num_sets, start_col, name_of_sets, nintersections, mbar_color, order_mat,
aggregate, cut, empty_intersects, decrease){
aggregate, cut, empty_intersects, decrease, keep.universal.empty.set = FALSE){
temp_data <- list()
Freqs <- data.frame()
end_col <- as.numeric(((start_col + num_sets) -1))
Expand All @@ -22,8 +22,12 @@ Counter <- function(data, num_sets, start_col, name_of_sets, nintersections, mba
all <- rbind(Freqs, empty)
Freqs <- data.frame(all[!duplicated(all[1:num_sets]), ], check.names = F)
}
#Remove universal empty set
Freqs <- Freqs[!(rowSums(Freqs[ ,1:num_sets]) == 0), ]

if (!keep.universal.empty.set){
# Remove universal empty set
Freqs <- Freqs[!(rowSums(Freqs[ ,1:num_sets]) == 0), ]
}

#Aggregation by degree
if(tolower(aggregate) == "degree"){
for(i in 1:nrow(Freqs)){
Expand Down
6 changes: 4 additions & 2 deletions R/upset.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#' @param shade.alpha Transparency of shading in matrix
#' @param matrix.dot.alpha Transparency of the empty intersections points in the matrix
#' @param empty.intersections Additionally display empty sets up to nintersects
#' @param keep.universal.empty.set Additionally displays the universal empty set (i.e. the set \code{c()} for which no choices are selected)
#' @param color.pal Color palette for attribute plots
#' @param boxplot.summary Boxplots representing the distribution of a selected attribute for each intersection. Select attributes by entering a character vector of attribute names (e.g. c("Name1", "Name2")).
#' The maximum number of attributes that can be entered is 2.
Expand Down Expand Up @@ -123,7 +124,7 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F
mb.ratio = c(0.70,0.30), expression = NULL, att.pos = NULL, att.color = main.bar.color, order.by = c("freq", "degree"),
decreasing = c(T, F), show.numbers = "yes", number.angles = 0, number.colors=NULL, group.by = "degree",cutoff = NULL,
queries = NULL, query.legend = "none", shade.color = "gray88", shade.alpha = 0.25, matrix.dot.alpha =0.5,
empty.intersections = NULL, color.pal = 1, boxplot.summary = NULL, attribute.plots = NULL, scale.intersections = "identity",
empty.intersections = NULL, keep.universal.empty.set = FALSE, color.pal = 1, boxplot.summary = NULL, attribute.plots = NULL, scale.intersections = "identity",
scale.sets = "identity", text.scale = 1, set_size.angles = 0 , set_size.show = FALSE, set_size.numbers_size = NULL, set_size.scale_max = NULL){

startend <-FindStartEnd(data)
Expand Down Expand Up @@ -162,7 +163,8 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F
Set_names <- order_sets(New_data, Set_names)
}
All_Freqs <- Counter(New_data, Num_of_set, first.col, Set_names, nintersects, main.bar.color,
order.by, group.by, cutoff, empty.intersections, decreasing)
order.by, group.by, cutoff, empty.intersections, decreasing,
keep.universal.empty.set = keep.universal.empty.set)
}
Matrix_setup <- Create_matrix(All_Freqs)
labels <- Make_labels(Matrix_setup)
Expand Down
3 changes: 3 additions & 0 deletions man/upset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.