formatDfByPlayer: Format dataframe, by player

Description Usage Arguments Details Value

View source: R/format_data.R

Description

formatDfByPlayer returns a dataframe formatted to visualize stats across players

Usage

1
formatDfByPlayer(dt, match, nStats, dStats, statName, xStat, valType, players)

Arguments

dt

A dataframe of stats, eg. a Sportscode matrix output.

match

(optional) A string. Indicates the game of interest.

nStats

A vector of strings. Indicate the columns used to calculate the aggregated value, or the numerator of a ratio when dStats are also passed in.

dStats

(optional) A vector of strings. Indicate the columns used to calculate the denominator of a ratio.

statName

A string. Indicates the formatted stat name for the plot.

xStat

(optional) A string. Adds a stat column to the dataframe; for plots that use the stat variable along the x axis.

valType

(optional) A string. Indicates how to calculate the stat value and set the stat label for the plot

players

A vector of strings. Specifies the names of the players for whom to pull stats.

Details

This function returns a formatted dataframe for visualizing data when comparing stats across players

Value

If all parameters are valid for the input dataframe, then the output will be a formatted dataframe.


ludisanalytics/ludisviz documentation built on Jan. 30, 2021, 12:46 a.m.