Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jokergoo committed Oct 21, 2019
1 parent 0ed4893 commit 62bd646
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/Upset.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ make_comb_mat_from_matrix = function(x, mode, top_n_sets = Inf, min_set_size = -
comb_mat = t(comb_mat)

nc = ncol(comb_mat)
comb_mat2 = Matrix::Matrix(0, nrow = nrow(comb_mat), ncol = nc*(nc-1)/2, sparse = TRUE)
comb_mat2 = matrix(0, nrow = nrow(comb_mat), ncol = nc*(nc-1)/2)
rownames(comb_mat2) = rownames(comb_mat)
if(mode == "intersect") {
if(nc > 1) {
Expand Down Expand Up @@ -223,7 +223,7 @@ make_comb_mat_from_list = function(lt, mode, value_fun = length, top_n_sets = In
complement_size = value_fun(complement_set)
}

comb_mat = Matrix::Matrix(FALSE, nrow = n, ncol = sum(choose(n, 1:n)), s)
comb_mat = matrix(FALSE, nrow = n, ncol = sum(choose(n, 1:n)))
rownames(comb_mat) = nm
j = 1
for(k in 1:n) {
Expand Down Expand Up @@ -579,7 +579,7 @@ comb_name = function(m, readable = FALSE) {
nm = sapply(strsplit(nm, ""), function(x) {
l = as.logical(as.numeric(x))
paste(sn[l], collapse = "&")
}
})
nm = unname(nm)
}

Expand Down
4 changes: 3 additions & 1 deletion man/comb_name.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Names of the Combination sets
Names of the Combination sets
}
\usage{
comb_name(m)
comb_name(m, readable = FALSE)
}
\arguments{

\item{m}{A combination matrix returned by \code{\link{make_comb_mat}}.}
\item{readable}{Whether the combination represents as e.g. "A&B&C".}

}
\details{
Expand All @@ -31,4 +32,5 @@ lt = list(a = sample(letters, 10),
c = sample(letters, 20))
m = make_comb_mat(lt)
comb_name(m)
comb_name(m, readable = TRUE)
}

0 comments on commit 62bd646

Please sign in to comment.