Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Keisuke ANDO
socceR
Commits
4e3a63e5
Commit
4e3a63e5
authored
Sep 27, 2022
by
Takumi Amano
💬
Browse files
[fix]kickall作った
parent
8979aa48
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/make_data.R
View file @
4e3a63e5
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment