makeBiVarData | R Documentation |
The resulting data can either: 1) be used with many of the other rties functions (a number of the preparatory functions and plotting will work in this way), but instead of "dyad" being the highest nesting variable, "person" is and should be substituted instead of dyad wherever you would otherwise use dyad, or 2) the data can be reformated again with the "dataPrep" function in rties (see overview_data_prep vignette for information on how to do this), with the resulting data in a format that can be used with any of the other rties functions.
makeBiVarData( basedata, personId, time_name, obs1_name, obs2_name, labels, idConvention )
basedata |
The original dataframe provided by the user that includes at least two time-series variables nested within-person |
personId |
The name of the column in the dataframe that has the person-level identifier. |
time_name |
The name of the column in the dataframe that indicates sequential temporal observations. |
obs1_name |
The name of the column in the dataframe that has the first time-series variable to be stacked. #' @param obs2_name The name of the column in the dataframe that has the second time-series variable to be stacked. |
labels |
A string vector with the names of the variables that are being stacked. |
idConvention |
A value that will be added to the varId of the first variable to get the varId for the second variable. It should be a larger value than the highest personId. This varId will then be used by rties in a way similar to personId when partners are nested in dyads. |
A dataframe that contains the original data, plus the following columns: 1) var: the names of the stacked variables (taken from "labels"). 2) obs: the stacked observed variable scores, 3) dist: a zero/one distinguishing variable, and 4) varId: a variable ID that is similar to personId for use with rties. The varId for the first stacked variable is the same as the personId, with the varId for the second stacked variable being personId + idConvention.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.