"sets" must be the first column of metadata to make a metadata plot
maureencarey opened this issue · 0 comments
maureencarey commented
This works:
df = data.frame(sample1 = c(0,1,1,0),sample2 = c(1,0,1,0),sample3 = c(0,1,0,1))
rownames(df) = c("one","two","three","four")
metadata = data.frame(sets = c("sample1","sample2","sample3"), variable = c("grp1","grp1","grp2"))
upset(df, main.bar.color = "black",
set.metadata = list(data = metadata,
plots = list(list(type = "matrix_rows", column = "variable", alpha = 0.5,
colors = c(grp1 = "green", grp2 = "navy")))))
but if you change the order of the metadata columns, e.g.:
metadata = metadata[c("variable","sets")]
an error pops up:
upset(df, main.bar.color = "black",
set.metadata = list(data = metadata,
plots = list(list(type = "matrix_rows", column = "variable", alpha = 0.5,
colors = c(grp1 = "green", grp2 = "navy")))))
Error in colors[[j]] :
attempt to select less than one element in integerOneIndex
the error message is somewhat counterintuitive to me, so I thought I'd post it in case anyone else runs into the same issue!