Query athletes using various filters. Omitting a filter means that athletes
with any value in that field will be returned. Filtering is case-insensitive
and for last_name
, first_name
, and brand
, string matching is partial.
Usage
query_athletes(
last_name = "",
first_name = "",
sector = "",
nation = "",
gender = "",
birth_year = "",
brand = "",
active_only = FALSE
)
Arguments
- last_name, first_name
last and first name. String matching is partial. The API does not support special characters, but many are handled automatically (see 'Details').
- sector
abbreviation of the sector, e.g., "AL" for alpine skiing. See the dataset sectors for possible values.
- nation
abbreviation of the nation, e.g., "SUI" for Switzerland. The value is matched exactly. See the dataset nations for possible values.
- gender
abbreviation of the gender: "M" for male or "F" for female
- birth_year
birth year. This also supports multiple years separated by commas (e.g, "1995,1998,2000") or year ranges (e.g., "1990-1995").
- brand
ski or snowboard brand used by the athlete. String matching is partial. The API does not support special characters, but many are handled automatically (see 'Details').
- active_only
should the query be restricted to active athletes.
Value
A tibble with the following columns: active
, fis_code
, name
, nation
,
age
, birthdate
, gender
, sector
, club
, brand
, and
competitor_id
.
active
is a logical indicating whether the athlete is still active. age
gives the year as an integer, but this value is often missing. birthdate
is returned as a character.
Details
The API does not support special character in the fields last_name
,
first_name
, and brand
. The following special characters are handled
automatically: à, á, å, ä, æ, ç, ć, č, ð, é, è, ê, ë, ï, ñ, ø, ó, ő, ö,
œ, š, ß, ú, ü, and ž.
Other special characters must be replaced by the suitable
substitute by the user.
One use of this function is to get the competitor id for an athlete, which
is needed in order to query an athletes results with query_results()
.
Examples
if (FALSE) { # \dontrun{
# find Swiss athletes with last name "Cuche"
query_athletes("cuche", nation = "SUI")
# find French alpine skiers using Rossignol skis
query_athletes(
sector = "AL",
nation = "FRA",
brand = "Rossignol",
active_only = TRUE
)
# find Loïc Maillard. Note that even if the "ï" may be used in the query,
# the name the name is returned without the special character.
query_athletes("meillard", "loïc")
# the query works the same without the special character
query_athletes("meillard", "loic")
} # }