dataPrep: Reformat a user-provided dataframe in a generic form...

Description Usage Arguments Value Examples

View source: R/rtiesShared.R

Description

The dataframe must be in a specific format and include several specific variables. See the "overview_data_prep" vignette for complete details on the necessary format and follow it closely if you'd like to avoid error messages. That vignette also includes information on how to structure the data if you have two variables within people (rather thean two people within dyads) or have indistinguishable dyads.

Usage

1
2
3
4
5
6
7
8
9
dataPrep(
  basedata,
  dyadId,
  personId,
  obs_name,
  dist_name,
  time_name,
  time_lag = NULL
)

Arguments

basedata

A user-provided dataframe that includes all variables needed for an rties analysis.

dyadId

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

personId

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

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.

time_lag

An optional argument for the number of lags for the lagged observable. If a number is provided, the observed variable is lagged that amount. The other option is to use "absMaxCC". In this case the maximum cross-correlation is found for each dyad and the lag at which that occurs is used to lag their observed variables.

Value

The function returns a dataframe that has all the variables needed for modeling system dynamics, each renamed to a generic variable name, which are:

Examples

1
2
3
4
5
data <- rties_ExampleDataShort
newData <- dataPrep(basedata=data, dyadId="couple", personId="person", obs_name="dial", 
dist_name="female", time_name="time", time_lag=2)
head(newData) 
 

rties documentation built on July 2, 2020, 4:11 a.m.