From 7c1b20e3a7358a7473b77cca12df6d867d4d1f67 Mon Sep 17 00:00:00 2001 From: takumiamano Date: Thu, 5 Jan 2023 17:51:40 +0900 Subject: [PATCH] =?UTF-8?q?[fix]DPL=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/make_data.R | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/R/make_data.R b/R/make_data.R index b0777e1..1728cc6 100755 --- a/R/make_data.R +++ b/R/make_data.R @@ -518,6 +518,41 @@ add_DynamicPressureLine <- function(action_All,name){ dpl_l <- get_DynamicPressureLine_D(action_l) dpl_r <- get_DynamicPressureLine_D(action_r) + output <- dplyr::inner_join(action_All,dpl_l,by="step") %>% + dplyr::inner_join(dpl_r,by="step",suffix = c("_l","_r")) + return(output) +} + +get_AttackLine_AS <- function(dribble) { + output <- dribble %>% + dplyr::group_by(step) %>% + filter(px == max(px)) %>% + dplyr::select( + step, + AL = px + ) + return(output) +} + +get_DynamicPressureLine_AS <- function(dribble) { + dribble <- dribble %>% + filter(unum != 1) + ad <- get_AttackLine_AS(dribble) + dd <- get_DefendLine(dribble) + md <- get_MedianLine(dribble) + output <- dplyr::inner_join(ad, dd, by = "step") %>% + dplyr::inner_join(md, by = "step") %>% + distinct(step, .keep_all = TRUE) %>% + dplyr::select(step,AL,ML,DL) + return(output) +} + +add_DynamicPressureLine_AS <- function(action_All,name){ + action_l <- select_name(action_All,name[1,2]) + action_r <- select_name(action_All,name[2,2]) + dpl_l <- get_DynamicPressureLine_AS(action_l) + dpl_r <- get_DynamicPressureLine_AS(action_r) + output <- dplyr::inner_join(action_All,dpl_l,by="step") %>% dplyr::inner_join(dpl_r,by="step",suffix = c("_l","_r")) return(output) -- GitLab