get_prem_form: Get rolling averages for points accumulated and goals scored...

View source: R/get_prem_form.R

get_prem_formR Documentation

Get rolling averages for points accumulated and goals scored for each team home and away.

Description

This functions returns a breakdown of each team's average points accumulated, goals scored and goals conceded home and away.

Usage

get_prem_form(
  prem_history = get_prem_history(),
  home_form_games_lag = 4,
  home_scored_games_lag = 4,
  home_conceded_games_lag = 4,
  away_form_games_lag = 4,
  away_scored_games_lag = 4,
  away_conceded_games_lag = 4
)

Arguments

prem_history

a data.frame of past fixtures given by get_prem_history()

home_form_games_lag

The count of lagged games to calculate average home points. Default is 4

home_scored_games_lag

The count of lagged games to calculate average home goals scored. Default is 4,

home_conceded_games_lag

The count of lagged games to calculate average home goals conceded. Default is 4,

away_form_games_lag

The count of lagged games to calculate average away points. Default is 4,

away_scored_games_lag

The count of lagged games to calculate average away goals scored. Default is 4,

away_conceded_games_lag

The count of lagged games to calculate average away goals conceded Default is 4,

Value

This function returns a data.frame with the following columns:

team

Character representing a team in a fixture

fixture

Character represening the fixture i.e. Arsenal v Everton

date

Date when the fixture was played

fthg

Numeric fulltime home goals scored in the fixture

ftag

Numeric fulltime away goals scored in the fixture

form

Numeric running average of points accumulated (3 for a win, 1 for a draw) either home or away

scored

Numeric running average of goals scored either home or away

conceded

Numeric running average of goals conceded either home or away

home

Numeric logical represnting whether the team was home or away

win

Numeric logical represnting whether the team won the fixture

draw

Numeric logical represnting whether the team drew the fixture

Author(s)

Daf Howells <dafhowells@yahoo.co.uk>

Examples

## Not run: 
prem_history <- get_prem_history()
prem_form_df <- get_prem_form(prem_history)

## End(Not run)

dafyddhowells/randy documentation built on Nov. 1, 2022, 4:01 p.m.