Commit 4e3a63e5 authored by Takumi Amano's avatar Takumi Amano 💬
Browse files

[fix]kickall作った

parent 8979aa48
......@@ -53,31 +53,30 @@ get_tackle <- function(action) {
return(output)
}
# get_kick <- function(action) {
# output <- action %>%
# dplyr::filter(command == "kick") %>%
# dplyr::mutate(before_team = lag(team)) %>%
# dplyr::mutate(before_unum = lag(unum)) %>%
# dplyr::mutate(after_team = lead(team)) %>%
# dplyr::mutate(after_unum = lead(unum)) %>%
# dplyr::mutate(b_sameteam = (before_team == team)) %>%
# dplyr::mutate(b_sameunum = (before_unum == unum)) %>%
# dplyr::mutate(a_sameteam = (after_team == team)) %>%
# dplyr::mutate(a_sameunum = (after_unum == unum))
# output$b_sameteam[1] <- TRUE
# output$b_sameunum[1] <- FALSE
# output <- output %>%
# dplyr::mutate(dribble = (a_sameteam & a_sameunum)) %>%
# dplyr::mutate(pass = (a_sameteam & !a_sameunum)) %>%
# group_by(grc = cumsum(!dribble)) %>%
# mutate(touch = row_number()) %>%
# ungroup() %>%
# select(-c(tackle_scc, grc, before_team, before_unum, b_sameteam, b_sameunum, after_team, after_unum, a_sameteam, a_sameunum))
# return(output)
# }
get_kick_log <- function(action) {
output <- action %>%
dplyr::filter(command == "kick") %>%
dplyr::mutate(before_team = lag(team)) %>%
dplyr::mutate(before_unum = lag(unum)) %>%
dplyr::mutate(after_team = lead(team)) %>%
dplyr::mutate(after_unum = lead(unum)) %>%
dplyr::mutate(b_sameteam = (before_team == team)) %>%
dplyr::mutate(b_sameunum = (before_unum == unum)) %>%
dplyr::mutate(a_sameteam = (after_team == team)) %>%
dplyr::mutate(a_sameunum = (after_unum == unum))
output$b_sameteam[1] <- TRUE
output$b_sameunum[1] <- FALSE
output <- output %>%
dplyr::mutate(dribble = (a_sameteam & a_sameunum)) %>%
dplyr::mutate(pass = (a_sameteam & !a_sameunum)) %>%
group_by(grc = cumsum(!dribble)) %>%
mutate(touch = row_number()) %>%
ungroup() %>%
select(-c(tackle_scc, grc, before_team, before_unum, b_sameteam, b_sameunum, after_team, after_unum, a_sameteam, a_sameunum))
return(output)
}
get_kick <- function(action) {
output <- action %>%
......@@ -92,6 +91,14 @@ get_kick <- function(action) {
return(output)
}
get_action_Allplayer <- function(players,action){
action <- action %>%
dplyr::select(step,action_team=team,ball_x,ball_y,pass,dribble)
output <- players %>%
dplyr::inner_join(action,by = "step")
return(output)
}
get_pass_Allplayer <- function(players,pass){
pass <- pass %>%
dplyr::select(step,pass_team=team,ball_x,ball_y,pass_scc)
......
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