Problem with UpSetR result
1
0
Entering edit mode
2.8 years ago
Raheleh ▴ 230

Hello, I have a dataframe with 3 variable and 56 observations which are just 1 and 0. Instead of venn diagram I am useing UpsetR package to find the intersections between variables. This is the link. This is my script:

dat <- read.delim("dat.csv", sep = ",", stringsAsFactors = FALSE)
upset(dat, nsets = 3, nintersects = 7, mb.ratio = c(0.5, 0.5))


This is my data:

LNMD    EMVI    EMPNI
0   0   0
0   0   0
0   0   0
0   0   0
0   0   0
0   1   0
0   1   0
0   1   0
0   1   0
0   1   0
0   1   0
0   1   0
1   0   0
1   0   0
1   0   0
1   0   0
1   0   0
1   0   0
1   0   0
1   0   1
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   0
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1
1   1   1


Although I got result, it is not correct. For example I sat the nintersects as 7 but it returned just 5!!! This is the image:

I really appreciate any help!

UpSetR Intersections upset • 971 views
0
Entering edit mode
2.8 years ago
russhh 5.6k

I can only see 6 non-empty intersections in your data, one of which is for those things that aren't a member of any of your three sets. You could add an additional column to indicate these separately

dat %>%
dplyr::mutate(Other = 1 * (rowSums(dat) == 0)) %>%
upset(.....)

0
Entering edit mode

Thanks, but I got this error:

Error in [.default(data, sets) : invalid subscript type 'list'