removeDyads | R Documentation |
Useful for cleaning data if some dyads have extensive missing or otherwise problematic data. The function will automatically remove dyads where the two partners have an unequal number of observations or completely missing data. If this happens it provides a warning, prints the dyads that were removed and returns two lists (unEqual and dyadsMissing) with the dyad ids. In addition, you can 1) provide a vector of dyad IDs to remove, or 2) provide a time cut to remove dyads with fewer time points than the cutoff.
removeDyads( basedata, dyadId, dist_name, obs_name, dyadsToCut = NULL, timeCut = NULL )
basedata |
A user provided dataframe. |
dyadId |
The variable in the dataframe specifying dyad ID. |
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. |
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). |
dyadsToCut |
A vector of dyad IDs to remove. |
timeCut |
The time value cutoff for removing dyads with fewer time points. |
A list with 1) a dataframe (basedata) with the data removed for dyads where the partners have unequal numbers of observations or completely missing data, any dyads specified by dyadsToCut, and dyads who had observations less than or equal to the timeCut value, 2) a list of the dyad IDs with unequal observations (unEqual) and 3) a list of the dyad IDs with completely missing observations (dyadsMissing).
data <- rties_ExampleDataShort dyadsToCut <- c(3, 12) newData <- removeDyads(basedata=data, dyadId="couple", obs_name="dial", dist_name="female", dyadsToCut=dyadsToCut, timeCut=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.