diff --git a/R/make_data.R b/R/make_data.R index b0777e10c56b0e1ebf48e48fab048dacd48bce5a..1728cc6f596322444c9c61673662bdbeed982d45 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)