extractScores: Get the latest scores from an eloTable object until specified...

Description Usage Arguments Details Value Examples

Description

Pulls players latest scores from an eloTable object until specified time. If no scores exist for an individual prior to that time in the table then the initial value is returned.

Usage

1
2
extractScores(eloTab, tObj = eloTab$datetime["end"],
  players = eloTab[["players"]])

Arguments

eloTab

an object of the class "eloTable" from which ratings are to be extracted.

tObj

an element of the class "POSIXct" for which only scores occuring prior to within the eloTable will be used.

players

A character list of players for which scores are obtained

Details

Using the datetime parameter as a cieling for elo ratings this function will return the latest rating for each player in the eloTable object which has occured on or before that time. If no score has occured prior to the specified time than the initial score is returned for that player with a value of NA for the time.

Value

A data frame containing the latest rating for each player up to the datetime parameter as well as the time which that rating was last updated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# generate generic data
interactions <- data.frame (a = sample (letters [1:10], 100, T),
                            b = sample (letters [1:10], 100, T),
                            o = sample (c(-1,-1,0,1,1), 100, T),
                            d = Sys.time () + runif (100, 40, 160))
# convert to interData object
id1 <- intTableConv (interactions)
# produce eloTable object
et1 <- eloTable (id1)
# get latest scores
extractScores (et1)
# only scores before median
extractScores (et1, tObj = median (et1$eloTable$datetime, na.rm = T))

nmmarquez/linHierarchy documentation built on May 23, 2019, 9:28 p.m.