Commit 085740a4 authored by Takumi Amano's avatar Takumi Amano 💬
Browse files

[fix]パスの目標を追加

parent 4e3a63e5
......@@ -53,6 +53,8 @@ get_tackle <- function(action) {
return(output)
}
get_kick_log <- function(action) {
output <- action %>%
dplyr::filter(command == "kick") %>%
......@@ -85,7 +87,7 @@ get_kick <- function(action) {
dplyr::mutate(after_unum = lead(unum)) %>%
dplyr::mutate(a_sameteam = (after_team == team)) %>%
dplyr::mutate(a_sameunum = (after_unum == unum)) %>%
select(-c(command, ax, ay, ball_vx, ball_vy, pvx, pvy, body, neck))
select(-c(command, pvx, pvy, body, neck))
return(output)
......@@ -101,7 +103,7 @@ get_action_Allplayer <- function(players,action){
get_pass_Allplayer <- function(players,pass){
pass <- pass %>%
dplyr::select(step,pass_team=team,ball_x,ball_y,pass_scc)
dplyr::select(step,ax,ay,pass_team=team,ball_x,ball_y,pass_scc)
output <- players %>%
dplyr::inner_join(pass,by = "step")
return(output)
......@@ -120,12 +122,16 @@ get_pass <- function(kick) {
dplyr::mutate(pass_scc = (a_sameteam & !a_sameunum)) %>%
dplyr::mutate(pass = ((a_sameteam & !a_sameunum) | (!a_tackle_scc & !a_sameteam))) %>%
dplyr::filter(pass) %>%
select(-c(a_tackle_scc,tackle_scc, pass, a_sameteam, a_sameunum, after_team, after_unum))
select(-c(a_tackle_scc,tackle_scc, pass, a_sameteam, a_sameunum, after_team, after_unum)) %>%
dplyr::mutate(next_ball_x = lead(ball_x)) %>%
dplyr::mutate(next_ball_y = lead(ball_y))
return(output)
}
get_dribble <- function(kick) {
output <- kick %>%
dplyr::mutate(dribble = ((!a_sameteam & a_tackle_scc) | (a_sameteam & a_sameunum))) %>%
......@@ -278,3 +284,44 @@ kick_dist <- function(rcg) {
) |>
dplyr::filter(move_dist != 0 & move_dist < 40)
}
select_name <- function(data,name){
output <- data %>%
dplyr::filter(team==name)
return(output)
}
get_AttackLine <- function(data){
output <- data %>%
dplyr::group_by(step) %>%
filter(px == max(px)) %>%
dplyr::select(step,AL=px)
return(output)
}
get_DefendLine <- function(data){
output <- data %>%
dplyr::group_by(step) %>%
filter(px == min(px)) %>%
dplyr::select(step,DL=px)
return(output)
}
get_MedianLine <- function(data){
output <- data %>%
dplyr::group_by(step) %>%
dplyr::summarize(ML=median(px)) %>%
dplyr::select(step,ML)
return(output)
}
get_DynamicPressureLine <- function(data){
data <- data %>%
filter(unum > 1)
ad <- get_AttackLine(data)
dd <- get_DefendLine(data)
md <- get_MedianLine(data)
output <- dplyr::inner_join(ad,dd,by = "step")
output <- dplyr::inner_join(output,md,by = "step")
return(output)
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment