The firstapiR functions
GetMatchResults return a data frame in team shape, i.e., with one team
listed in every row, and six rows per match. R documentation often refers to
data frames in this format as narrow data frames.
will convert these narrow data frames to a wide data frame (it's wide because
it has more columns) with three teams per row and two rows per match, one row
for the blue alliance and one row for the red alliance.
A firstapiR data frame. The data frame must inherit from the schedule, hybridSchedule, or emphmatchResults class data frames that are returned by firstapiR functions. The data frame must also be in team shape and have the shape attribute set to "team".
ToMatchShape will only convert data frames that are in team shape, with their
shape attribute set to "team". To convert data frame that are in alliance
shape to match shape, first use
ToTeamShape to convert the data frame
back to team shape, and then use
ToMatchShape to convert it to match
FirstapiR proivdes functions to reshape data frames because different shapes are useful for different purposes. For example, team shape is useful for extracting data for a single team because it's only necessary to subset the data frame on the team column. Match shape is useful for displaying schedules. Alliance shape is useful for calculating offensive power rating (OPR).
This function throws an error if df does not inherit from matchResults, schedule, or hybridSchedule, or if the data frame's shape attribute is missing or is anything other than team.
A data frame of class schedule, hybridSchedule, or matchResults (depending on the class of the df argument) in match shape, with the shape attribute set to "alliance".
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.