dyadByContext: Creates variables indicating dyad by context membership...

View source: R/rtiesShared.R

dyadByContextR Documentation

Creates variables indicating dyad by context membership (dyadContext) and person by context (personContext) membership. These are renamed by the dataPrep function into "dyad" and "person," which can be used as normal for all other rties functions that use the dataframe produced by dataPrep. Other functions that use the dataframe prior to the dataPrep step will need to use the dyadContext and personContext variables instead.

Description

Creates variables indicating dyad by context membership (dyadContext) and person by context (personContext) membership. These are renamed by the dataPrep function into "dyad" and "person," which can be used as normal for all other rties functions that use the dataframe produced by dataPrep. Other functions that use the dataframe prior to the dataPrep step will need to use the dyadContext and personContext variables instead.

Usage

dyadByContext(
  basedata,
  dyadId,
  personId,
  context,
  obs_name,
  dist_name,
  time_name,
  idConvention
)

Arguments

basedata

A user-provided dataframe.

dyadId

The name of the column in the dataframe that has the couple-level identifier.

personId

The name of the column in the dataframe that has the person-level identifier.

context

The name of the column in the dataframe that has the variable indicating context. This must be an integer variable.

obs_name

The name of the column in the dataframe that has the time-varying observable (e.g., the variable for which dynamics will be assessed).

dist_name

The name of the column in the dataframe that has a variable that distinguishes the partners (e.g., sex, mother/daughter, etc) that is numeric and scored 0/1.

time_name

The name of the column in the dataframe that indicates sequential temporal observations. #' @param idConvention The value that was added to the dist1 personID number to get the dist2 personID number

Value

The function returns the original dataframe with additional variables, called "dyadContext" and "personContext." These have the original dyad or person ID numbers with the context number * .001 appended. For example, dyad 33 in context 4 would get the value for "dyadContext" of 33.004. Similarly, person 502 in context 2 would get the value 502.002.

#' @export


ebmtnprof/rties documentation built on Aug. 25, 2022, 7:47 p.m.