Description Usage Arguments Value References Examples
View source: R/fc_locations_link.R
This function converts data
from a tibble to a simple feature object
by adding a linestring geometry that links the starting and ending locations
of each event in data
.
1 | fc_locations_link(data, start_loc, end_loc)
|
data |
A data frame with event location data. |
start_loc |
A character vector identifying the |
end_loc |
A character vector identifying the |
A simple feature object with a new variable named geometry
.
The variable geometry
is a linestring object.
Pappalardo, L., Cintia, P., Rossi, A. et al. A public data set of spatio-temporal match events in soccer competitions. Sci Data 6, 236 (2019). https://doi.org/10.1038/s41597-019-0247-7
All public Wyscout data is available at https://figshare.com/collections/Soccer_match_event_dataset/4415000/2
1 2 3 4 5 6 7 8 9 10 11 | # load dplyr for examples
library(dplyr)
# read event data given in package
file_path <- system.file("extdata", "events_england.json", package = "scoutr")
events <- fc_read_events(file_path)
events %>%
select(event_sec:end_y) %>%
fc_locations_transform(x = c("start_x", "end_x"), y = c("start_y", "end_y")) %>%
fc_locations_link(start_loc = c("start_x", "start_y"), end_loc = c("end_x", "end_y"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.