From d7e638d135134b84364dbd9fad2256fe4aeb59a7 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 27 Feb 2023 14:24:56 -0500 Subject: [PATCH] Use `relationship` on dplyr >=1.1.0.9000 --- R/utils.R | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/R/utils.R b/R/utils.R index 07c052a..9e7d96c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -172,14 +172,25 @@ get_matchups <- function(cr_data) { select("game", "player", "score") class(cr) <- class(tibble::tibble()) - left_join( - x = cr, - y = cr, - by = "game", - suffix = c("1", "2"), - multiple = "all" - ) %>% - as_widecr() + if (utils::packageVersion("dplyr") >= "1.1.0.9000") { + out <- left_join( + x = cr, + y = cr, + by = "game", + suffix = c("1", "2"), + relationship = "many-to-many" + ) + } else { + out <- left_join( + x = cr, + y = cr, + by = "game", + suffix = c("1", "2"), + multiple = "all" + ) + } + + as_widecr(out) }