place {SwimmeR}R Documentation

Add places to results

Description

Places are awarded on the basis of time, with fastest (lowest) time winning. For diving places are awarded on the basis of score, with the highest score winning. Ties are placed as ties (both athletes get 2nd etc.)

Usage

place(
  df,
  result_col = Finals,
  max_place = NULL,
  event_type = "ind",
  max_relays_per_team = 1,
  keep_nonscoring = TRUE,
  verbose = TRUE
)

Arguments

df

a data frame with results from swim_parse, including swimming and/or diving results. df must contain a column called Event

result_col

the name of a column in df containing times and/or scores on which to place (order) performances. Default is Finals

max_place

highest place value that scores

event_type

either "ind" for individual or "relay" for relays

max_relays_per_team

an integer value denoting the number of relays a team may score (usually 1)

keep_nonscoring

are athletes in places greater than max_place be retained in the data frame. Either TRUE or FALSE

verbose

should warning messages be posted. Default is TRUE and should rarely be changed.

Value

a data frame modified so that places have been appended based on swimming time and/or diving score

See Also

swim_place is a helper function used inside of results_score

Examples

  df <- data.frame( Place = c(1, 1, 1, 1, 1, 1), Name = c("Sally Swimfast",
  "Bonnie Bubbles", "Kylie Kicker", "Riley Ripit", "Nathan Nosplash", "Tim
  Tuck"), Team = c("KVAC", "UBAM", "MERC", "Upstate Diving", "Nickel City
  Splash", "Finger Lakes Diving"), Event = c(rep("Women 200 Freestyle", 3),
  rep("Boys 1 mtr Diving", 3)), Prelims = c("2:00.00", "1:59.99", "2:01.50",
  "300.00", "305.00", "200.00"), Finals = c("1:58.00", "1:59.50", "2:00.50",
  "310.00", "307.00", "220.00"), Meet = c("Summer 2021", "Fall 2020", "Champs
  2020","Regional Champs 2021", "Other Regional Champs 2021", "City Champs
  2021" ))

df %>%
  place() %>%
  dplyr::arrange(Event)

df %>%
  place(result_col = Prelims) %>%
  dplyr::arrange(Event)

df %>%
  place(result_col = "Prelims") %>%
  dplyr::arrange(Event)


[Package SwimmeR version 0.14.2 Index]