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
fdcc4c80
Commit
fdcc4c80
authored
Feb 16, 2023
by
Takumi Amano
💬
Browse files
[add]ゴールの判定を変更
parent
7c1b20e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/make_data.R
View file @
fdcc4c80
...
...
@@ -37,6 +37,19 @@ read_goal <- function(referee, name) {
return
(
goal
)
}
read_goal_no_judge
<-
function
(
goal
)
{
goal
<-
goal
|>
dplyr
::
select
(
step
,
side
,
name
,
score
,
)
return
(
goal
)
}
get_player
<-
function
(
rcg
,
name
)
{
output
<-
rcg
|>
dplyr
::
inner_join
(
name
,
by
=
"side"
)
|>
...
...
@@ -210,8 +223,10 @@ get_pass <- function(kick) {
output
<-
kick
|>
dplyr
::
filter
(
pass
==
TRUE
)
%>%
distinct
(
step
,
.keep_all
=
TRUE
)
%>%
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
,
pass
,
pass_scc
)
dplyr
::
select
(
step
,
team
,
unum
,
px
,
py
,
pvx
,
pvy
,
ball_x
,
ball_y
,
ball_vx
,
ball_vy
,
next_ball_vx
,
next_ball_vy
,
pass
,
pass_scc
)
%>%
dplyr
::
mutate
(
next_ball_x
=
lead
(
ball_x
))
%>%
dplyr
::
mutate
(
next_ball_y
=
lead
(
ball_y
))
%>%
drop_na
()
return
(
output
)
}
...
...
@@ -556,4 +571,61 @@ add_DynamicPressureLine_AS <- function(action_All,name){
output
<-
dplyr
::
inner_join
(
action_All
,
dpl_l
,
by
=
"step"
)
%>%
dplyr
::
inner_join
(
dpl_r
,
by
=
"step"
,
suffix
=
c
(
"_l"
,
"_r"
))
return
(
output
)
}
get_movie
<-
function
(
rcl
,
ball
,
players
)
{
referee
<-
get_referee
(
rcl
)
output
<-
rcl
|>
dplyr
::
mutate
(
unum
=
as.numeric
(
unum
)
)
|>
dplyr
::
select
(
step
,
team
,
unum
,
command
,
)
|>
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
::
arrange
(
step
)
return
(
output
)
}
get_DPL
<-
function
(
movie
)
{
movie
<-
movie
%>%
filter
(
unum
!=
1
)
ad
<-
movie
%>%
dplyr
::
group_by
(
step
)
%>%
filter
(
px
==
max
(
px
))
%>%
dplyr
::
select
(
step
,
AL
=
px
)
md
<-
movie
%>%
dplyr
::
group_by
(
step
)
%>%
dplyr
::
summarize
(
ML
=
median
(
px
))
%>%
dplyr
::
select
(
step
,
ML
)
dd
<-
movie
%>%
dplyr
::
group_by
(
step
)
%>%
filter
(
px
==
min
(
px
))
%>%
dplyr
::
select
(
step
,
DL
=
px
)
output
<-
dplyr
::
inner_join
(
ad
,
dd
,
by
=
"step"
)
%>%
dplyr
::
inner_join
(
md
,
by
=
"step"
)
%>%
distinct
(
step
,
.keep_all
=
TRUE
)
return
(
output
)
}
get_movie
<-
function
(
ball
,
players
)
{
output
<-
players
|>
dplyr
::
inner_join
(
ball
,
by
=
"step"
)
%>%
dplyr
::
distinct
(
step
,
team
,
unum
,
.keep_all
=
TRUE
)
%>%
dplyr
::
arrange
(
step
)
%>%
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
)
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