@@ -40,7 +40,10 @@ data("fakesurveyDyn")
4040fakesurveyDyn
4141```
4242
43- ``` {r 2-static-dynsurvey-cont1}
43+ ``` {r}
44+ #| label: 2-static-dynsurvey-cont1
45+ #| warning: false
46+ #| message: false
4447diffnet_dynsurvey <- survey_to_diffnet(
4548 dat = fakesurveyDyn,
4649 idvar = "id",
@@ -63,7 +66,11 @@ plot_diffnet(diffnet_dynsurvey)
6366
6467Let's have a look to ` kfamily ` :
6568
66- ``` {r kfamily-look}
69+ ``` {r}
70+ #| label: kfamily-survey
71+ #| warning: false
72+ #| message: false
73+
6774data(kfamily)
6875unique(kfamily$village)
6976
@@ -73,7 +80,11 @@ hist(kfamily$toa)
7380
7481We can construct a ` diffnet ` object from from those survey data:
7582
76- ``` {r kfamily-survey-to-diffnet, warnings=FALSE, messages=FALSE}
83+ ``` {r}
84+ #| label: kfamily-survey-to-diffnet
85+ #| warning: false
86+ #| message: false
87+
7788kfamily_diffnet <- survey_to_diffnet(
7889 dat = kfamily,
7990 idvar = "id",
@@ -93,7 +104,11 @@ summary(kfamily_diffnet)
93104```
94105
95106We can calculate direct exposure (cohesion) to an innovation using ` exposure() ` ,
96- ``` {r kfamily-cohesion, warnings=FALSE, messages=FALSE}
107+ ``` {r}
108+ #| label: kfamily-exposure
109+ #| warning: false
110+ #| message: false
111+
97112# Computing exposure
98113coh <- exposure(kfamily_diffnet)
99114
@@ -103,7 +118,11 @@ head(round(coh, 2))
103118
104119and also indirect influence (structural equivalence):
105120
106- ``` {r kfamily-se, warnings=FALSE, messages=FALSE}
121+ ``` {r}
122+ #| label: kfamily-se
123+ #| warning: false
124+ #| message: false
125+
107126# Computing structural equivalence
108127se <- exposure(kfamily_diffnet,
109128 alt.graph="se", # select 'structural equivalence'
@@ -117,9 +136,14 @@ head(round(se, 2))
117136
118137Finally...
119138
120- ``` {r kfamily-attr, warnings=FALSE, messages=FALSE}
139+ ``` {r}
140+ #| label: kfamily-diffnet-attrs
141+ #| warning: false
142+ #| message: false
143+
121144# Retrieving attributes as data.frame
122145kfamily_diffnet.df <- diffnet.attrs(kfamily_diffnet, as.df = TRUE)
146+ ncol(kfamily_diffnet.df)
123147```
124148
125149
0 commit comments