I have a dataset like this:
df <- structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40), a = c(0, 0,
0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1,
1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0), b = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1), c = c(0,
0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0), d = c(1,
1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0,
0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0), e = c(0,
0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -40L))
I am using UpSetR to find all the possible combinations between a, b, c, d, and e and to get a nice graph. This is my code:
library(UpSetR)
graph <- upset(df,
sets = c("a", "b", "c", "d", "e"),
order.by = "freq",
empty.intersections = "on")
As you can see if you try using this code, there is an error message
Error in start_col:end_col : argument of length 0
In addition: There were 12 warnings (use warnings() to see them)
Warning messages:
1: In xtfrm.data.frame(x) : cannot xtfrm data frames
2: In xtfrm.data.frame(x) : cannot xtfrm data frames
3: In xtfrm.data.frame(x) : cannot xtfrm data frames
4: In xtfrm.data.frame(x) : cannot xtfrm data frames
5: In xtfrm.data.frame(x) : cannot xtfrm data frames
6: In xtfrm.data.frame(x) : cannot xtfrm data frames
7: In xtfrm.data.frame(x) : cannot xtfrm data frames
8: In xtfrm.data.frame(x) : cannot xtfrm data frames
9: In xtfrm.data.frame(x) : cannot xtfrm data frames
10: In xtfrm.data.frame(x) : cannot xtfrm data frames
11: In xtfrm.data.frame(x) : cannot xtfrm data frames
12: In xtfrm.data.frame(x) : cannot xtfrm data frames
How do I solve the problem? I don't understand the problem as this dataset looks exactly as "mutations" dataset used as example here https://github.com/hms-dbmi/UpSetR
I solved the issue. It seems that when importing datasets it is important to convert them to dataframe before using UpsetR, thus as.data.frame(df)
before using the code of UpsetR!
It works now.
This explains why in the dataset mutations the code was working correctly