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 all six teams listed in one row and only one row
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 a data frame that is 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
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 matchResults, schedule, or hybridSchedule (depending on the class of the df argument) in match shape, with the shape attribute set to "match".
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.