GetMatchResults: Get match scores and participating teams

Description Usage Arguments Details Value Columns See Also Examples

View source: R/firstapiR_main.R

Description

The data frame returned by GetMatchResults() is in team shape, i.e., each row contains data for a single team and there are six rows per match. Use ToAllianceShape() or ToMatchShape() to convert the data frame to a three-teams-per-row shape or a six-teams-per-row shape.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
GetMatchResults(
  session,
  event,
  level = "qual",
  team = NULL,
  match = NULL,
  start = NULL,
  end = NULL,
  mod_since = NULL,
  only_mod_since = NULL
)

Arguments

session

A Session object created with GetSession().

event

A character vector containing a FIRST API event code (see GetEvents).

level

A character vector containing either "qual" or "playoff". Defaults to "qual". Optional.

team

An integer vector containing a team number. Optional. Cannot specify match when team is specified.

match

An integer vector containing a match number. Optional. If specified, GetMatchResults returns results for only the specified match. If level is not specified, returns the results for the qualification match. To get playoff match results, set level to "playoff". Cannot specify team when match is specified.

start

An integer vector containing the earliest match to return. Optional.

end

An integer vector containing the latest match to return. Optional.

mod_since

A character vector containing an HTTP formatted date and time. Returns NA if no changes have been made to the requested data since the date and time provided. Optional.

only_mod_since

A character vector containing an HTTP formatted date and time. This function only returns data that has changed since the date and time provided. Optional.

Details

See the Match Results section of the FIRST API documentation at http://docs.frcevents2.apiary.io/# for more details.

The FIRST API URL format is:

https://frc-api.firstinspires.org/v2.0/season/matches/event ?tournamentLevel=level&teamNumber=team&matchNumber=match&start=start&end=end

Value

Depending on the session$format value, returns JSON text, an XML::XMLDocument object, or a data.frame with class set to c("data.frame, "MatchResults"). Returns a logical vector of length one with value NA if data is unchanged since date and time passed in arguments mod_since or only_mod_since.

Columns

  1. match: integer

  2. description: character

  3. level: factor

  4. actualStart: character

  5. postResult: character

  6. team: factor

  7. alliance: factor (Blue, Red)

  8. station: factor (Red1, Red2, Red3, Blue1, Blue2, Blue3)

  9. disqualified: logical

  10. scoreFinal, scoreAuto, scoreFoul: integer

See Also

Refer to Standard_attributes for data attributes returned by this function.

Examples

1
2
3
4
5
sn <- GetSession("username", "key", season = 2016)
GetMatchResults(sn, "PNCMP", level="qual")
GetMatchResults(sn, "PNCMP", team="2990")
GetMatchResults(sn, "WAAMV", match=2, level="playoff")
GetMatchResults(sn, "CMP-ARCHIMEDES", level="qual", start=10, end=20)

irwinsnet/firstapiR documentation built on Dec. 22, 2020, 5:13 p.m.