From 9b41a85373e8b47451e0d77e2119b1540b266acc Mon Sep 17 00:00:00 2001 From: takumiamano Date: Fri, 9 Dec 2022 20:51:29 +0900 Subject: [PATCH] =?UTF-8?q?[fix]passAll=E3=81=AE=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 | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/R/make_data.R b/R/make_data.R index d6c8967..1870e07 100755 --- a/R/make_data.R +++ b/R/make_data.R @@ -89,8 +89,8 @@ get_action <- function(rcl,ball,players) { ) |> dplyr::inner_join(players, by = c("step", "team", "unum"))%>% dplyr::inner_join(ball, by = "step") %>% - dplyr::distinct(step,team, .keep_all = TRUE) %>% - dplyr::full_join(referee,by="step") %>% + dplyr::distinct(step,team, .keep_all = TRUE) %>% + dplyr::full_join(referee,by="step") %>% dplyr::arrange(step) %>% dplyr::mutate(next_judge = lead(judge)) %>% dplyr::filter(command == "kick" | command == "tackle" | command == "catch") %>% @@ -120,19 +120,19 @@ get_kick_log <- function(action,goal) { output$b_sameteam[1] <- TRUE output$b_sameunum[1] <- FALSE output <- dplyr::full_join(output,goal,by=c("step","judge","side")) %>% - dplyr::arrange(step) %>% - dplyr::mutate(next_score = lead(score)) %>% - dplyr::mutate(next_judge = lead(judge)) %>% + dplyr::arrange(step) %>% + dplyr::mutate(next_score = lead(score)) %>% + dplyr::mutate(next_judge = lead(judge)) %>% dplyr::mutate(is_goal = (!is.na(next_score)&(side==lead(side)))) %>% dplyr::filter(command == "kick") %>% - dplyr::mutate(shoot_scc = (judge == "NULL") & is_goal) %>% + dplyr::mutate(shoot_scc = (judge == "NULL") & is_goal) %>% dplyr::mutate(dribble_scc = ( (judge == "NULL") & (next_judge == "NULL") & a_sameteam & a_sameunum)) %>% dplyr::mutate(pass_scc = ( (judge == "NULL") & (next_judge == "NULL") & a_sameteam & !a_sameunum)) %>% dplyr::mutate(shoot = ( - shoot_scc | - abs(target_ball_x) > 54 & abs(target_ball_y) < 12)) %>% + shoot_scc | + abs(target_ball_x) > 54 & abs(target_ball_y) < 12)) %>% dplyr::mutate(dribble = ( (!shoot)& (!dribble_scc)& @@ -151,7 +151,7 @@ get_kick_log <- function(action,goal) { } get_kick <- function(kick_log) { - output <- action %>% + output <- action %>% dplyr::filter(command == "kick") %>% select(-c(command, pvx, pvy, body, neck)) return(output) @@ -167,9 +167,10 @@ get_action_Allplayer <- function(players, action) { get_pass_Allplayer <- function(players, pass) { pass <- pass %>% - dplyr::select(step, px, py, pass_team = team, ball_x, ball_y, ball_vx, ball_vy, pass_scc) + dplyr::select(step,pass_team = team,ball_x,ball_y,ball_vx,ball_vy,next_ball_x,next_ball_y,next_ball_vx,next_ball_vy,pass,pass_scc) output <- players %>% - dplyr::inner_join(pass, by = "step") + dplyr::inner_join(pass, by = "step") %>% + dplyr::distinct(step,team,unum, .keep_all = TRUE) return(output) } @@ -185,7 +186,7 @@ get_pass <- function(kick) { output <- kick |> dplyr::filter(pass == TRUE) %>% distinct(step, .keep_all = TRUE) %>% - dplyr::select(step,team,numu,px,py,pvx,pvy,ball_x,ball_y,ball_vx,ball_vy,next_ball_x,next_ball_y,next_ball_vx,next_ball_vy,pass,pass_scc) + dplyr::select(step,team,unum,px,py,pvx,pvy,ball_x,ball_y,ball_vx,ball_vy,next_ball_x,next_ball_y,next_ball_vx,next_ball_vy,pass,pass_scc) return(output) } -- GitLab