find_runs | R Documentation |
Find runs of events within a match. Typically, this function would be passed a subset of plays(x)
, such as rows
corresponding to serves. Runs that are terminated by the end of a set are not assigned a run_length
.
find_runs(x, idvars = "team", within_set = TRUE)
x |
data.frame: a subset of the plays component of a datavolley object, as returned by |
idvars |
character: string or character vector of variabe names to use to identify the entity doing the events |
within_set |
logical: only consider runs within a single set? If FALSE, runs that span sets will be treated as a single run |
A data.frame the same number of rows as x
, and with columns run_id
(the identifier of the run to which each row belongs), run_length
(the length of the run), and run_position
(the position of this row in its associated run).
dv_read
plays
## Not run:
## find runs of serves
x <- dv_read(dv_example_file(), insert_technical_timeouts = FALSE)
serve_idx <- find_serves(plays(x))
serve_run_info <- find_runs(plays(x)[serve_idx,])
## distribution of serve run lengths
table(unique(serve_run_info[,c("run_id","run_length")])$run_length)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.