The final activity for each learning lab provides space to work with data and to reflect on how the concepts and techniques introduced in each lab might apply to your own research.
To earn a badge for each lab, you are required to respond to a set of prompts for two parts:
In Part I, you will reflect on your understanding of key concepts addressed in the case study and essential readings and begin to think about potential next steps for your own study.
In Part II, you will create a simple data product in R that demonstrates your ability to apply a data analysis technique introduced in this learning lab.
Use your institutional library, Google Scholar, or search engine of your choice to locate a research article, presentation, or resource that applies social network analysis to an educational context or topic of interest. More specifically, locate a network study that makes use of group, positional, or egocentric analysis. You are also welcome to select one of the research papers listed in the essential readings that may have piqued your interest.
Provide an APA citation for your selected study.
What research questions were the authors of this study trying to address and why did they consider these questions important?
How was group, positional, or egocentric analysis used in this study to address these research questions?
What were the results of these analyses?
Think about a network that you are a part of, or may be interested in studying, and answer the following questions:
What is a research question that you might ask about this network that would require group, positional, or egocentric analysis?
Which approach or approaches would you use to answer this question?
What measures would you collected as part of your analysis? Why?
Using one of the datasets provided in the data folder, create
a polished table, chart, and/or sociogram that highlights a network’s
groups and/or key actors. For example, you may be interested in
examining the characteristics of central actors that emerged in the
Massively Open Online Courses for Educators (MOOC-Eds) using
dlt1-edges and dlt1-nodes datasets that were
introduced in Learning Lab 2.
Alternatively, you may use your own data set to explore groups or central actors using the techniques demonstrated in the guided practice.
I highly recommend creating a new R script in your lab-3 folder to complete this task. When your code is ready to share, use the code chunk below to share only the code and comments necessary to run and undestand your analysis, then answer the questions that follow.
# YOUR FINAL CODE HERE
#load library
library(tidyverse) #package of package. core package (data cleaning, data visualization, importing, wrangling etc)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidygraph) #improved version of igraph
##
## Attaching package: 'tidygraph'
##
## The following object is masked from 'package:stats':
##
## filter
library(ggraph) # built chart, graph for network analysis
library(igraph) #old R style
##
## Attaching package: 'igraph'
##
## The following object is masked from 'package:tidygraph':
##
## groups
##
## The following objects are masked from 'package:lubridate':
##
## %--%, union
##
## The following objects are masked from 'package:dplyr':
##
## as_data_frame, groups, union
##
## The following objects are masked from 'package:purrr':
##
## compose, simplify
##
## The following object is masked from 'package:tidyr':
##
## crossing
##
## The following object is masked from 'package:tibble':
##
## as_data_frame
##
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
##
## The following object is masked from 'package:base':
##
## union
library(skimr)
library(tidytext)
#load files
ccss_tweets <- read_csv("data/ccss-tweets-simple.csv")
## Rows: 51 Columns: 90
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (49): screen_name, text, source, reply_to_screen_name, hashtags, urls_u...
## dbl (26): user_id, status_id, display_text_width, reply_to_status_id, reply...
## lgl (11): is_quote, is_retweet, quote_count, reply_count, symbols, ext_medi...
## dttm (4): created_at, quoted_created_at, retweet_created_at, account_create...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#View(ccss_network) # this doesnt really tell anything so just type the variable.
ties_1 <- ccss_tweets |>
relocate(sender = screen_name, # rename scree_name to sender
target = mentions_screen_name) |> # rename to receiver
select(sender,
target,
created_at,
text)
ties_1
## # A tibble: 51 × 4
## sender target created_at text
## <chr> <chr> <dttm> <chr>
## 1 2bux15cents <NA> 2021-11-07 17:32:08 "At …
## 2 AlexiosAsText MaggieEThornton 2021-11-07 15:22:14 "@Ma…
## 3 tx_granny BanjoTanJoe MillennialOther Richar… 2021-11-06 19:29:41 "@Mi…
## 4 PaprBagPrincss <NA> 2021-11-05 20:31:28 "#CC…
## 5 Tech4Learning <NA> 2021-11-05 18:01:00 "6 w…
## 6 listland <NA> 2021-11-05 12:30:40 "Top…
## 7 CapitolAdvocate <NA> 2021-11-05 12:28:25 "\"I…
## 8 CapitolAdvocate MichaelPetrilli CapitolAdvocate 2021-10-31 11:56:22 "\"A…
## 9 BanjoTanJoe MillennialOther Richard_Harambe Re… 2021-11-05 00:26:23 "@Mi…
## 10 MaendelWealth 4Patrick7 BookerSparticus 2021-11-04 13:16:29 "@4P…
## # ℹ 41 more rows
ties_2 <- ties_1 %>%
unnest_tokens(input = target,
output = receiver,
to_lower = FALSE) %>%
relocate(sender, receiver)
ties_2
## # A tibble: 311 × 4
## sender receiver created_at text
## <chr> <chr> <dttm> <chr>
## 1 2bux15cents <NA> 2021-11-07 17:32:08 "At what point will the …
## 2 AlexiosAsText MaggieEThornton 2021-11-07 15:22:14 "@MaggieEThornton If eno…
## 3 tx_granny BanjoTanJoe 2021-11-06 19:29:41 "@MillennialOther @Richa…
## 4 tx_granny MillennialOther 2021-11-06 19:29:41 "@MillennialOther @Richa…
## 5 tx_granny Richard_Harambe 2021-11-06 19:29:41 "@MillennialOther @Richa…
## 6 tx_granny RepMikeJohnson 2021-11-06 19:29:41 "@MillennialOther @Richa…
## 7 PaprBagPrincss <NA> 2021-11-05 20:31:28 "#CCChat (Common Core Ch…
## 8 Tech4Learning <NA> 2021-11-05 18:01:00 "6 ways to incorporate d…
## 9 listland <NA> 2021-11-05 12:30:40 "Top 10 Reasons Why Stan…
## 10 CapitolAdvocate <NA> 2021-11-05 12:28:25 "\"I’ve had students who…
## # ℹ 301 more rows
ties <- ties_2 %>%
drop_na(receiver)
write_csv(ties, "data/ccss-edgelist.csv")
actors_1 <- ties %>%
select(sender, receiver) %>%
pivot_longer(cols = c(sender,receiver))
actors <- actors_1 %>%
select(value) %>%
rename(actors = value) %>%
distinct()
write_csv(actors, "data/ccss-nodelist.csv")
ccss_network <- tbl_graph(edges = ties,
nodes = actors)
autograph(ccss_network)
ccss_network <- ccss_network |>
activate(nodes) |>
mutate(weak_component = group_components(type = "weak"))
autograph(ccss_network)
as_tibble(ccss_network)
## # A tibble: 92 × 2
## actors weak_component
## <chr> <int>
## 1 AlexiosAsText 10
## 2 MaggieEThornton 10
## 3 tx_granny 3
## 4 BanjoTanJoe 3
## 5 MillennialOther 3
## 6 Richard_Harambe 3
## 7 RepMikeJohnson 3
## 8 CapitolAdvocate 5
## 9 MichaelPetrilli 5
## 10 MaendelWealth 6
## # ℹ 82 more rows
ccss_network |>
as_tibble() |>
group_by(weak_component) |>
summarise(count = n()) |>
arrange(desc(count))
## # A tibble: 13 × 2
## weak_component count
## <int> <int>
## 1 1 51
## 2 2 8
## 3 3 5
## 4 4 5
## 5 5 3
## 6 6 3
## 7 7 3
## 8 8 3
## 9 9 3
## 10 10 2
## 11 11 2
## 12 12 2
## 13 13 2
ccss_network <- ccss_network |>
activate(nodes) |>
mutate(strong_component = group_components(type = "strong"))
autograph(ccss_network)
as_tibble(ccss_network)
## # A tibble: 92 × 3
## actors weak_component strong_component
## <chr> <int> <int>
## 1 AlexiosAsText 10 91
## 2 MaggieEThornton 10 92
## 3 tx_granny 3 86
## 4 BanjoTanJoe 3 87
## 5 MillennialOther 3 90
## 6 Richard_Harambe 3 89
## 7 RepMikeJohnson 3 88
## 8 CapitolAdvocate 5 84
## 9 MichaelPetrilli 5 85
## 10 MaendelWealth 6 81
## # ℹ 82 more rows
ccss_network |>
as_tibble() |>
group_by(strong_component) |>
summarise(count = n()) |>
arrange(desc(count))
## # A tibble: 92 × 2
## strong_component count
## <int> <int>
## 1 1 1
## 2 2 1
## 3 3 1
## 4 4 1
## 5 5 1
## 6 6 1
## 7 7 1
## 8 8 1
## 9 9 1
## 10 10 1
## # ℹ 82 more rows
clique_num(ccss_network)
## Warning in clique_num(ccss_network): At
## core/cliques/maximal_cliques_template.h:268 : Edge directions are ignored for
## maximal clique calculation.
## [1] 3
cliques(ccss_network, min = 3, max = NULL)
## Warning in cliques(ccss_network, min = 3, max = NULL): At
## core/cliques/cliquer_wrapper.c:57 : Edge directions are ignored for clique
## calculations.
## [[1]]
## + 3/92 vertices, from 7262b99:
## [1] 35 36 37
##
## [[2]]
## + 3/92 vertices, from 7262b99:
## [1] 3 4 7
##
## [[3]]
## + 3/92 vertices, from 7262b99:
## [1] 3 4 6
##
## [[4]]
## + 3/92 vertices, from 7262b99:
## [1] 3 4 5
ccss_network <- ccss_network |>
morph(to_undirected) |>
activate(nodes) |>
mutate(sub_group = group_edge_betweenness()) |>
unmorph()
ccss_network |>
as_tibble()
## # A tibble: 92 × 4
## actors weak_component strong_component sub_group
## <chr> <int> <int> <int>
## 1 AlexiosAsText 10 91 10
## 2 MaggieEThornton 10 92 10
## 3 tx_granny 3 86 3
## 4 BanjoTanJoe 3 87 3
## 5 MillennialOther 3 90 3
## 6 Richard_Harambe 3 89 3
## 7 RepMikeJohnson 3 88 3
## 8 CapitolAdvocate 5 84 5
## 9 MichaelPetrilli 5 85 5
## 10 MaendelWealth 6 81 6
## # ℹ 82 more rows
ccss_undirected <- to_undirected(ccss_network)
ccss_undirected
## # A tbl_graph: 92 nodes and 289 edges
## #
## # An undirected multigraph with 13 components
## #
## # A tibble: 92 × 4
## actors weak_component strong_component sub_group
## <chr> <int> <int> <int>
## 1 AlexiosAsText 10 91 10
## 2 MaggieEThornton 10 92 10
## 3 tx_granny 3 86 3
## 4 BanjoTanJoe 3 87 3
## 5 MillennialOther 3 90 3
## 6 Richard_Harambe 3 89 3
## # ℹ 86 more rows
## #
## # A tibble: 289 × 4
## from to created_at text
## <int> <int> <dttm> <chr>
## 1 1 2 2021-11-07 15:22:14 @MaggieEThornton If enough were gathered coul…
## 2 3 4 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## 3 3 5 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## # ℹ 286 more rows
ccss_network |>
activate(nodes) |>
as_tibble() |>
group_by(sub_group) |>
summarise(count = n()) |>
arrange(desc(count))
## # A tibble: 13 × 2
## sub_group count
## <int> <int>
## 1 1 51
## 2 2 8
## 3 3 5
## 4 4 5
## 5 5 3
## 6 6 3
## 7 7 3
## 8 8 3
## 9 9 3
## 10 10 2
## 11 11 2
## 12 12 2
## 13 13 2
ccss_network |>
activate(nodes) |>
mutate(group = group_infomap())
## # A tbl_graph: 92 nodes and 289 edges
## #
## # A directed multigraph with 13 components
## #
## # A tibble: 92 × 5
## actors weak_component strong_component sub_group group
## <chr> <int> <int> <int> <int>
## 1 AlexiosAsText 10 91 10 10
## 2 MaggieEThornton 10 92 10 10
## 3 tx_granny 3 86 3 4
## 4 BanjoTanJoe 3 87 3 4
## 5 MillennialOther 3 90 3 4
## 6 Richard_Harambe 3 89 3 4
## # ℹ 86 more rows
## #
## # A tibble: 289 × 4
## from to created_at text
## <int> <int> <dttm> <chr>
## 1 1 2 2021-11-07 15:22:14 @MaggieEThornton If enough were gathered coul…
## 2 3 4 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## 3 3 5 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## # ℹ 286 more rows
ccss_network |>
activate(nodes) |>
mutate(group = group_label_prop())
## # A tbl_graph: 92 nodes and 289 edges
## #
## # A directed multigraph with 13 components
## #
## # A tibble: 92 × 5
## actors weak_component strong_component sub_group group
## <chr> <int> <int> <int> <int>
## 1 AlexiosAsText 10 91 10 9
## 2 MaggieEThornton 10 92 10 9
## 3 tx_granny 3 86 3 3
## 4 BanjoTanJoe 3 87 3 3
## 5 MillennialOther 3 90 3 3
## 6 Richard_Harambe 3 89 3 3
## # ℹ 86 more rows
## #
## # A tibble: 289 × 4
## from to created_at text
## <int> <int> <dttm> <chr>
## 1 1 2 2021-11-07 15:22:14 @MaggieEThornton If enough were gathered coul…
## 2 3 4 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## 3 3 5 2021-11-06 19:29:41 @MillennialOther @Richard_Harambe @RepMikeJoh…
## # ℹ 286 more rows
ccss_network <- ccss_network |>
activate(nodes) |>
mutate(size = local_size())
ccss_network |>
as_tibble() |>
arrange(desc(size)) |>
select(actors, size)
## # A tibble: 92 × 2
## actors size
## <chr> <dbl>
## 1 rdsathene 51
## 2 waltduro 8
## 3 tx_granny 5
## 4 BanjoTanJoe 5
## 5 namaikatikura 5
## 6 MillennialOther 3
## 7 Richard_Harambe 3
## 8 RepMikeJohnson 3
## 9 CapitolAdvocate 3
## 10 MaendelWealth 3
## # ℹ 82 more rows
ccss_network <- ccss_network |>
activate(nodes) |>
mutate(in_degree = centrality_degree(mode = "in"),
out_degree = centrality_degree(mode = "out"))
ccss_network |>
as_tibble()
## # A tibble: 92 × 7
## actors weak_component strong_component sub_group size in_degree out_degree
## <chr> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 Alexios… 10 91 10 2 0 1
## 2 MaggieE… 10 92 10 2 1 0
## 3 tx_gran… 3 86 3 5 0 4
## 4 BanjoTa… 3 87 3 5 1 3
## 5 Millenn… 3 90 3 3 2 0
## 6 Richard… 3 89 3 3 2 0
## 7 RepMike… 3 88 3 3 2 0
## 8 Capitol… 5 84 5 3 2 2
## 9 Michael… 5 85 5 2 1 0
## 10 Maendel… 6 81 6 3 0 2
## # ℹ 82 more rows
ccss_network |>
as_tibble() |>
ggplot() +
geom_histogram(aes(x = in_degree))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ccss_network |>
as_tibble() |>
skim()
| Name | as_tibble(ccss_network) |
| Number of rows | 92 |
| Number of columns | 7 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| numeric | 6 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| actors | 0 | 1 | 3 | 15 | 0 | 92 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| weak_component | 0 | 1 | 3.25 | 3.43 | 1 | 1.00 | 1.0 | 4.25 | 13 | ▇▁▁▁▁ |
| strong_component | 0 | 1 | 46.50 | 26.70 | 1 | 23.75 | 46.5 | 69.25 | 92 | ▇▇▇▇▇ |
| sub_group | 0 | 1 | 3.25 | 3.43 | 1 | 1.00 | 1.0 | 4.25 | 13 | ▇▁▁▁▁ |
| size | 0 | 1 | 2.80 | 5.15 | 2 | 2.00 | 2.0 | 2.00 | 51 | ▇▁▁▁▁ |
| in_degree | 0 | 1 | 3.14 | 2.14 | 0 | 1.00 | 5.0 | 5.00 | 6 | ▆▁▁▁▇ |
| out_degree | 0 | 1 | 3.14 | 25.63 | 0 | 0.00 | 0.0 | 0.00 | 246 | ▇▁▁▁▁ |
ccss_network |>
as_tibble() |>
filter(size < 51) |>
group_by(weak_component) |>
select(size) |>
skim()
## Adding missing grouping variables: `weak_component`
| Name | select(…) |
| Number of rows | 91 |
| Number of columns | 2 |
| _______________________ | |
| Column type frequency: | |
| numeric | 1 |
| ________________________ | |
| Group variables | weak_component |
Variable type: numeric
| skim_variable | weak_component | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|---|
| size | 1 | 0 | 1 | 2.00 | 0.00 | 2 | 2 | 2 | 2.0 | 2 | ▁▁▇▁▁ |
| size | 2 | 0 | 1 | 2.75 | 2.12 | 2 | 2 | 2 | 2.0 | 8 | ▇▁▁▁▁ |
| size | 3 | 0 | 1 | 3.80 | 1.10 | 3 | 3 | 3 | 5.0 | 5 | ▇▁▁▁▅ |
| size | 4 | 0 | 1 | 2.60 | 1.34 | 2 | 2 | 2 | 2.0 | 5 | ▇▁▁▁▂ |
| size | 5 | 0 | 1 | 2.33 | 0.58 | 2 | 2 | 2 | 2.5 | 3 | ▇▁▁▁▃ |
| size | 6 | 0 | 1 | 2.33 | 0.58 | 2 | 2 | 2 | 2.5 | 3 | ▇▁▁▁▃ |
| size | 7 | 0 | 1 | 2.33 | 0.58 | 2 | 2 | 2 | 2.5 | 3 | ▇▁▁▁▃ |
| size | 8 | 0 | 1 | 2.33 | 0.58 | 2 | 2 | 2 | 2.5 | 3 | ▇▁▁▁▃ |
| size | 9 | 0 | 1 | 3.00 | 0.00 | 3 | 3 | 3 | 3.0 | 3 | ▁▁▇▁▁ |
| size | 10 | 0 | 1 | 2.00 | 0.00 | 2 | 2 | 2 | 2.0 | 2 | ▁▁▇▁▁ |
| size | 11 | 0 | 1 | 2.00 | 0.00 | 2 | 2 | 2 | 2.0 | 2 | ▁▁▇▁▁ |
| size | 12 | 0 | 1 | 2.00 | 0.00 | 2 | 2 | 2 | 2.0 | 2 | ▁▁▇▁▁ |
| size | 13 | 0 | 1 | 2.00 | 0.00 | 2 | 2 | 2 | 2.0 | 2 | ▁▁▇▁▁ |
ccss_network <- ccss_network |>
activate(nodes) |>
mutate(closeness = centrality_closeness(),
betweenness = centrality_betweenness()) |>
arrange(desc(betweenness))
ccss_network |>
as_tibble()
## # A tibble: 92 × 9
## actors weak_component strong_component sub_group size in_degree out_degree
## <chr> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 Capitol… 5 84 5 3 2 2
## 2 Alexios… 10 91 10 2 0 1
## 3 MaggieE… 10 92 10 2 1 0
## 4 tx_gran… 3 86 3 5 0 4
## 5 BanjoTa… 3 87 3 5 1 3
## 6 Millenn… 3 90 3 3 2 0
## 7 Richard… 3 89 3 3 2 0
## 8 RepMike… 3 88 3 3 2 0
## 9 Michael… 5 85 5 2 1 0
## 10 Maendel… 6 81 6 3 0 2
## # ℹ 82 more rows
## # ℹ 2 more variables: closeness <dbl>, betweenness <dbl>
ggraph(ccss_network, layout = "fr") +
geom_node_point() +
geom_edge_link()
## Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
ggraph(ccss_network, layout = "fr") +
geom_node_point(aes(size = out_degree,
color = out_degree)) +
geom_edge_link() +
theme_graph()
ggraph(ccss_network, layout = "fr") +
geom_node_point(aes(size = out_degree,
color = out_degree)) +
geom_node_text(aes(label = actors,
size = out_degree/2,
color = out_degree),
repel=TRUE) +
geom_edge_link() +
theme_graph()
## Warning: ggrepel: 3 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
ggraph(ccss_network, layout = "fr") +
geom_node_point(aes(size = out_degree,
color = out_degree)) +
geom_node_text(aes(label = actors,
size = out_degree/2,
color = out_degree),
repel=TRUE) +
geom_edge_link(arrow = arrow(length = unit(1, 'mm')),
end_cap = circle(3, 'mm'),
alpha = .2) +
theme_graph()
## Warning: ggrepel: 2 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
ggraph(ccss_network, layout = 'linear', circular = TRUE) +
geom_node_point(aes(size = out_degree,
color = out_degree)) +
geom_node_text(aes(label = actors,
size = out_degree/2,
color = out_degree),
repel=TRUE) +
geom_edge_link(arrow = arrow(length = unit(1, 'mm')),
end_cap = circle(3, 'mm'),
alpha = .2) +
theme_graph()
ccss_network |>
ggraph(layout = "fr") +
geom_node_point() +
geom_edge_link(arrow = arrow(length = unit(1, 'mm')),
end_cap = circle(3, 'mm'),
alpha = .2) +
theme_graph() +
geom_node_voronoi(aes(fill = factor(sub_group),
alpha = .05),
max.radius = .5,
show.legend = FALSE)
How would you frame a research question that this analysis helps to answer?
What groups and/or central actors were identified in your analysis?
How, if at all, might this information be useful for understanding or improving the learning context from which the data was collected?
To receive credit for this assignment and earn your first SNA LASER Badge, you will first need to knit and publish this page to Posit Cloud. Next, share the link to published webpage under one of the Badge Artifact columns on the 2023 LASER Scholar Information and Documents spreadsheet: https://go.ncsu.edu/laser-sheet. Once your instructor has checked your link, you will be provided a physical version of the badge pictured at the top of this document!