GetScores: Get detailed match scores

Description Usage Arguments Details Value Columns See Also Examples

View source: R/firstapiR_main.R

Description

The results vary depending on the season requested. The 2016 data fields are listed here. See the FIRST API documentation at http://docs.frcevents2.apiary.io/# for data fields for prior seasons. The data frame contains two rows for each match, one for blue and the other for red.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
GetScores(
  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

GetScores() contains both the blue and red alliance scores for each match, but it does not list the teams assigned to each alliance. Use firstapiR MergeResults() function to merge the data frames returned by GetHybridSchedule and GetScores() to create a data frame that contains both team numbers and detailed scores: MergeResults(hybrid_df, scores_df) should do the trick.

See the Detailed Scores 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/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, "Scores"). 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. level: character

  2. match: integer

  3. audienceGroup: factor

  4. alliance: factor

  5. robot1Auto, robot2Auto, robot3Auto: factor

  6. autoBouldersLow, autoBouldersHigh: integer

  7. teleopBouldersLow, teleopBouldersHigh: integer

  8. towerFaceA, towerFaceB, towerFaceC: factor

  9. towerEndStrength: integer

  10. teleopTowerCaptured, teleopDefensesBreached: logical

  11. position1, position2, position3, position4, position5: factor

  12. position1Crossings, position2Crossings, position3Crossings, position4Crossings, position5Crossings: integer

  13. foulCount, techFoulCount: integer

  14. autoPoints, autoReachPoints, autoCrossingPoints, autoBoulderPoints: integer

  15. teleopPoints, teleopCrossingPoints, teleopBoulderPoints, teleopChallengePoints, teleopScalePoints: integer

  16. breachPoints, capturePoints: integer

  17. adustPoints, foulPoints, totalPoints: integer

See Also

Refer to Standard_attributes for data attributes returned by this function.

Refer to MergeResults for guidance on how to merge the Scores and HybridSchedule data frames.

Examples

1
2
3
4
sn <- GetSession("username", "key", season = 2016)
archimedes_qual_scores <- GetScores(sn, event = "ARCHIMEDES")
first_10_qual_matches <- GetScores(sn, event = "WAELL", start = 1, end = 10)
qual_match_10_scores <- GetScores(sn, event = "WAELL", match = 15)

irwinsnet/FIRST_api_R documentation built on Dec. 22, 2020, 5:12 p.m.