GetEvents: Get information about FRC events

Description Usage Arguments Details Value Columns See Also Examples

View source: R/firstapiR_main.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
GetEvents(
  session,
  event = NULL,
  team = NULL,
  district = NULL,
  exclude_district = 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. If event is specified, GetEvents() will return results only for the specified event. Optional.

team

An integer vector containing a team number. Optional

district

A character vector containing the FIRST API district code (see GetDistricts()). If district is specified, GetTeams() will filter results to only the events in the specified district. Optional.

exclude_district

A logical vector. If set to TRUE, district events are excluded from results. 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

GetEvents will accept either the team or district parameters, neither parameter, or both parameters. If neither team nor district are specified, GetEvents returns all FRC events for the competition season. If team is specified, the results are filtered to only the events in which the FRC team participated. Similarly, if district is specified, the results are filtered to only the events that occurred within the specified district. If exclude_district is set to TRUE, then only non-district events are returned. The district and exclude_district events may not be specified at the same time.

Throws an error if team is specified and any other arguments are specified, or if both the district and exclude_district arguments are specified.

The FIRST API URL format is:

https://frc-api.firstinspires.org/v2.0/season/events? teamNumber=team&districtCode=district&excludeDistrict=district

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, "Events"). 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. code: character

  2. divisionCode: character

  3. name: character

  4. type: factor ('Regional', 'DistrictEvent', 'DistrictChampionship', 'ChampionshipSubdivision', 'ChampionshipDivision', 'Championship', 'Offseason')

  5. districtCode: factor ('CHM', 'FIM', 'IN', 'MAR', 'NC', 'PCH', 'PNW')

  6. venue: character

  7. city: character

  8. stateprov: factor

  9. country: factor

  10. timezone: factor

  11. dateStart: character

  12. dateEnd: character

  13. eventCount: integer

See Also

Refer to Standard_attributes for data attributes returned by this function.

Examples

1
2
3
4
sn <- GetSession("username", "key", season = 2016)
team5803_events <- GetEvents(sn, team = 5803)
pacificNW_events <- GetEvents(sn, district = 'PNW')
team360_nondist_events <- GetEvents(sn, team = 360, exclude_district = TRUE)

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