Learn R Programming

soccermatics (version 0.9.5)

soccerVelocity: Compute instantaneous distance, speed and direction from x,y-coordinates

Description

Compute instantaneous distance moved (in metres), speed (in metres per second), and direction (in radians) between subsequent frames in a dataframe of x,y-coordinates.

Usage

soccerVelocity(dat)

Arguments

dat

dataframe containing unnormalised x,y-coordinates x and y, time variable 't', and player identifier 'id'

Value

a dataframe with columns 'dist', 'speed', and 'direction' added

Examples

Run this code
# NOT RUN {
data(tromso)

# calculate distance, speed, and direction for \code{tromso} dataset
soccerVelocity(tromso)

# }

Run the code above in your browser using DataLab