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
9b41a853
Commit
9b41a853
authored
Dec 09, 2022
by
Takumi Amano
💬
Browse files
[fix]passAllの修正
parent
a202ee9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/make_data.R
View file @
9b41a853
...
...
@@ -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
,
num
u
,
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
,
u
num
,
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
)
}
...
...
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