Learn R Programming

fbRanks (version 2.0)

create.newdata.dataframe: Helper Function to Replace Team Names in Score File with a Uniform Name from Team Data Frame.

Description

Helper function not exported for users. Used by predict.fbRanks() to construct the newdata data frame.

Usage

create.newdata.dataframe(x, newdata, min.date, max.date, ...)

Arguments

x
A fbRanks object.
newdata
A data.frame of data to use for predicting. At the minimum home.team, away.team and any predictors in x (the fbRanks model) are required.
max.date, min.date
Used for filtering the matches in newdata.
...
Other arguments for to use for filtering the scores data.frame or newdata data.frame. You can use any column in the scores or teams data frames. Name of the argument should be the column name and values passed in as a vector.

Value

A list with elements scores and teams.

Details

This is taking a list or data frame passed in in the newdata argument of a predict.fbRanks call and constructing a data frame that can be passed to glm or lmer. It ensures that the uniform names (name column of x$teams) are used. It uses resolve.team.names.