hms-dbmi/UpSetR

sets parameter in upset when a column has only 0 (bug)

bowenli37 opened this issue · 0 comments

An error was encountered when I ran the following code :

d <- data.frame(a = rep(0, 10), b = sample(0:1, 10, replace = T), c = sample(0:1, 10, replace = T))
## upset(d) works fine
upset(d, sets = c('a', 'b', 'c'))

Error in `[.data.frame`(data, , start_col:end_col) : 
undefined columns selected

There are 3 columns a,b,c in the data frame and a has only 0.

A little effort of debugging finds in the upset function

 startend <- FindStartEnd(data)
 first.col <- startend[1]  # value is 2
 last.col <- startend[2]  # value is 3

and in FindSetFreqs function

end_col <- as.numeric(((start_col + num_sets) - 1))
# start_col is 2
# num_sets is 3, which is wrong