Learn R Programming

injurytools (version 2.0.1)

cut_injd: Cut the range of the follow-up

Description

Given an injd object, cut the range of the time period such that the limits of the observed dates, first and last observed dates, are date0 and datef, respectively. It is possible to specify just one date, i.e. the two dates of the range do not necessarily have to be entered. See Note section.

Usage

cut_injd(injd, date0, datef)

Value

An injd object with a shorter follow-up period.

Arguments

injd

Prepared data, an injd object.

date0

Starting date of class Date or numeric. If numeric, it should refer to a year (e.g. date = 2018). Optional.

datef

Ending date. Same class as date0. Optional.

Examples

Run this code
# Prepare data
# \donttest{
df_injuries <- prepare_inj(
  df_injuries0   = raw_df_injuries,
  person_id      = "player_name",
  date_injured   = "from",
  date_recovered = "until"
)

df_exposures <- prepare_exp(
  df_exposures0 = raw_df_exposures,
  person_id     = "player_name",
  date          = "year",
  time_expo     = "minutes_played"
)

injd <- prepare_all(
  data_exposures = df_exposures,
  data_injuries  = df_injuries,
  exp_unit       = "matches_minutes"
)
# }

# \donttest{
cut_injd(injd, date0 = 2018)
# }

Run the code above in your browser using DataLab