make_target_date_df_sh: Create a data frame with year-long intervals prior to...

View source: R/rewrite_make_target_dates.R

make_target_date_df_shR Documentation

Create a data frame with year-long intervals prior to specific target dates

Description

Create a data frame with year-long intervals prior to specific target dates

Usage

make_target_date_df_sh(
  target_df,
  babase,
  members_l,
  window_length = 1,
  window_length_day = 0,
  min_pres_day = 0,
  .by_grp = TRUE,
  .adults_only = TRUE,
  series = F,
  overlap = 0,
  direction = "backward"
)

Arguments

target_df

A data frame that includes the columns sname, sex, grp, and date

babase

A DBI connection to the babase database

members_l

A subset of members table produced by the function 'subset_members'

window_length

Length in years of the time window for the social index

window_length_day

Length in days in addition to years of the time window

min_pres_day

minimum number of days in a group, default to 0

.by_grp

Logical indicating whether to separate by group. Default is TRUE

.adults_only

Logical indicating whether to include adults only. Default is TRUE

series

logical indicating whether to create a series instead of a single value

overlap

in term of days, default to zero

direction

"backward" or "forward", direction to create window, default to backward from obs_date

Value

A tibble with one row per animal (and optionally, per group) and target date, with contextual data


lycium0605/SHfunction documentation built on Feb. 5, 2023, 11:14 a.m.