# use internal data set
data(lawdata)
adj.advice <- lawdata[[1]]
adj.cowork <- lawdata[[3]]
df.att <- lawdata[[4]]
# three steps of data editing of attribute dataframe:
# 1. categorize variables 'years' and 'age' based on
# approximately three equally size groups (values based on cdf)
# 2. make sure all outcomes start from the value 0 (optional)
# 3. remove variable 'senior' as it consists of only unique values (thus redundant)
df.att.ed <- data.frame(
status = df.att$status,
gender = df.att$gender,
office = df.att$office - 1,
years = ifelse(df.att$years <= 3, 0,
ifelse(df.att$years <= 13, 1, 2)
),
age = ifelse(df.att$age <= 35, 0,
ifelse(df.att$age <= 45, 1, 2)
),
practice = df.att$practice,
lawschool = df.att$lawschool - 1
)
# actor attribute converted to dyad variable
dyad.gend <- get_dyad_var(df.att.ed$gender, "att")
# directed tie converted to dyad variable
dyad.adv <- get_dyad_var(adj.advice, "tie")
# undirected tie converted to dyad variable
dyad.cwk <- get_dyad_var(adj.cowork, "tie")
Run the code above in your browser using DataLab