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
5f7de2f7
Commit
5f7de2f7
authored
Dec 15, 2022
by
Takumi Amano
💬
Browse files
[fix]ドリブル関連の修正
parent
f7d347eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/make_data.R
View file @
5f7de2f7
...
@@ -175,7 +175,7 @@ get_pass_Allplayer <- function(players, pass) {
...
@@ -175,7 +175,7 @@ get_pass_Allplayer <- function(players, pass) {
get_dribble_Allplayer
<-
function
(
players
,
dribble
)
{
get_dribble_Allplayer
<-
function
(
players
,
dribble
)
{
dribble
<-
dribble
%>%
dribble
<-
dribble
%>%
dplyr
::
select
(
step
,
dribble_team
=
team
,
ball_x
,
ball_y
,
dribble_scc
)
dplyr
::
select
(
step
,
dribble_team
=
team
,
ball_x
,
ball_y
,
ball_vx
,
ball_vy
,
next_ball_x
,
next_ball_y
,
next_ball_vx
,
next_ball_vy
,
dribble
,
dribble_scc
)
output
<-
players
%>%
output
<-
players
%>%
dplyr
::
inner_join
(
dribble
,
by
=
"step"
)
dplyr
::
inner_join
(
dribble
,
by
=
"step"
)
return
(
output
)
return
(
output
)
...
@@ -192,18 +192,20 @@ get_pass <- function(kick) {
...
@@ -192,18 +192,20 @@ get_pass <- function(kick) {
get_dribble
<-
function
(
kick
)
{
get_dribble
<-
function
(
kick
)
{
output
<-
kick
%>%
output
<-
kick
%>%
dplyr
::
mutate
(
dribble
=
((
!
a_sameteam
&
a_tackle_scc
)
|
(
a_sameteam
&
a_sameunum
)))
%>%
dplyr
::
filter
(
dribble
==
TRUE
)
%>%
dplyr
::
mutate
(
dribble_scc
=
(
a_sameteam
&
a_sameunum
))
%>%
distinct
(
step
,
.keep_all
=
TRUE
)
%>%
group_by
(
grc
=
cumsum
(
!
dribble
))
%>%
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
,
dribble
,
dribble_scc
)
mutate
(
touch
=
row_number
())
%>%
ungroup
()
%>%
dplyr
::
filter
(
dribble
)
%>%
select
(
-
c
(
a_tackle_scc
,
tackle_scc
,
dribble
,
a_sameteam
,
a_sameunum
,
next_team
,
next_unum
,
dribble
,
grc
))
return
(
output
)
return
(
output
)
}
}
get_dp
<-
function
(
dribbleAll
){
output
<-
dribbleAll
|>
dplyr
::
mutate
(
p_speed
=
sqrt
(
pvx
^
2
+
pvy
^
2
))
%>%
dplyr
::
mutate
(
theta
=
atan2
(
pvx
,
pvy
))
%>%
dplyr
::
mutate
(
cos
=
cos
(
theta
),
sin
=
sin
(
theta
))
return
(
output
)
}
before_goal
<-
function
(
kick_log
,
goal_step
,
goal_team
)
{
before_goal
<-
function
(
kick_log
,
goal_step
,
goal_team
)
{
playlist
<-
kick_log
%>%
playlist
<-
kick_log
%>%
...
@@ -347,3 +349,39 @@ get_DynamicPressureLine <- function(pass) {
...
@@ -347,3 +349,39 @@ get_DynamicPressureLine <- function(pass) {
distinct
(
step
,
.keep_all
=
TRUE
)
distinct
(
step
,
.keep_all
=
TRUE
)
return
(
output
)
return
(
output
)
}
}
get_AttackLine_D
<-
function
(
dribble
)
{
output
<-
dribble
%>%
dplyr
::
group_by
(
step
)
%>%
filter
(
px
==
max
(
px
))
%>%
dplyr
::
select
(
step
,
dribble_team
,
dribble_scc
,
AL
=
px
)
return
(
output
)
}
get_DynamicPressureLine_D
<-
function
(
dribble
)
{
dribble
<-
dribble
%>%
filter
(
unum
!=
1
)
ad
<-
get_AttackLine_D
(
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
<-
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_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
)
}
\ No newline at end of file
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