Skip to content

Commit

Permalink
Correct usage for old dplyr-1.0.0 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanlinlin82 committed Aug 16, 2020
1 parent a686a84 commit 288b042
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/ggvenn.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ prepare_venn_data <- function(data, columns = NULL,
stopifnot(is.logical(as_tibble(data)[,columns[[2]], drop = TRUE]))
d <- gen_circle_2()
d1 <- gen_text_pos_2() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((!xor(d1$A[[i]], as_tibble(data)[,columns[[1]]])) &
(!xor(d1$B[[i]], as_tibble(data)[,columns[[2]]])))
Expand All @@ -204,7 +204,7 @@ prepare_venn_data <- function(data, columns = NULL,
stopifnot(is.logical(as_tibble(data)[,columns[[3]], drop = TRUE]))
d <- gen_circle_3()
d1 <- gen_text_pos_3() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B, C) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, C, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((!xor(d1$A[[i]], as_tibble(data)[,columns[[1]]])) &
(!xor(d1$B[[i]], as_tibble(data)[,columns[[2]]])) &
Expand All @@ -222,7 +222,7 @@ prepare_venn_data <- function(data, columns = NULL,
stopifnot(is.logical(as_tibble(data)[,columns[[4]], drop = TRUE]))
d <- gen_circle_4()
d1 <- gen_text_pos_4() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B, C, D) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, C, D, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((d1$A[[i]] == as_tibble(data)[,columns[[1]], drop = TRUE]) &
(d1$B[[i]] == as_tibble(data)[,columns[[2]], drop = TRUE]) &
Expand All @@ -247,7 +247,7 @@ prepare_venn_data <- function(data, columns = NULL,
if (length(columns) == 2) {
d <- gen_circle_2()
d1 <- gen_text_pos_2() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((!xor(d1$A[[i]], a2 %in% data[[columns[[1]]]])) &
(!xor(d1$B[[i]], a2 %in% data[[columns[[2]]]])))
Expand All @@ -258,7 +258,7 @@ prepare_venn_data <- function(data, columns = NULL,
} else if (length(columns) == 3) {
d <- gen_circle_3()
d1 <- gen_text_pos_3() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B, C) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, C, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((!xor(d1$A[[i]], a2 %in% data[[columns[[1]]]])) &
(!xor(d1$B[[i]], a2 %in% data[[columns[[2]]]])) &
Expand All @@ -270,7 +270,7 @@ prepare_venn_data <- function(data, columns = NULL,
} else if (length(columns) == 4) {
d <- gen_circle_4()
d1 <- gen_text_pos_4() %>% mutate(n = 0, text = "")
stopifnot((d1 %>% count(A, B, C, D) %>% with(n)) == 1)
stopifnot((d1 %>% count(A, B, C, D, wt = 1) %>% with(n)) == 1)
for (i in 1:nrow(d1)) {
idx <- ((!xor(d1$A[[i]], a2 %in% data[[columns[[1]]]])) &
(!xor(d1$B[[i]], a2 %in% data[[columns[[2]]]])) &
Expand Down

0 comments on commit 288b042

Please sign in to comment.