set_relay_type: Set a baton's relay type

set_relay_typeR Documentation

Set a baton's relay type

Description

set_relay_type is a helper function to set the 'relay_type' of the baton; this flag can be accessed by the user to help control how batons are accessed. The updated metadata will occur both in the source YAML as well as the R object for paired consistency. There are three types of relay: 'CANCELLED', 'PRACTICE', or 'COMPETITION'. The default is 'COMPETITION'. This can be adjusted globally by options(relay_type = "COMPETITION")

Usage

set_relay_type(
  baton,
  threshold = getOption("relay_type", default = "COMPETITION"),
  suppressWarnings = TRUE,
  autoassign = TRUE,
  envir = .GlobalEnv,
  ...
)

Arguments

baton

R object of S3 class, created by create_baton.

threshold

character value for the type of the baton (e.g. 'CANCELLED', 'PRACTICE', or 'COMPETITION').

suppressWarnings

boolean value to determine if warning messages upon YAML write are ignored.

autoassign

boolean value to determine if the passed baton is also refreshed automatically. Recommended as TRUE to avoid having to do manual assignment to provided baton.

envir

Environment where baton exists, default set to .GlobalEnv, only needed when autoassign is TRUE. If deploying on RStudio Connect, may require using knitr::knit_global().

...

Additional parameters passed to assign

Value

S3 class object.

Examples

## Not run: 
my_baton <- create_baton()

set_relay_type(my_baton, 'CANCELLED')
read_metadata(my_baton)$relay_type

set_referee(my_baton, 'COMPETITION')
read_metadata(my_baton)$relay_type

## End(Not run)

al-obrien/relay documentation built on May 6, 2023, 10:19 p.m.