Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

JADS Master - Social Network Analysis for Data Scientists [R] Cheatsheet

Rating
-
Sold
1
Pages
7
Uploaded on
03-01-2022
Written in
2020/2021

[R] Cheatsheet for the Social Network Analysis for Data Scientists course of the Master Data Science and Entrepreneurship.

Institution
Course

Content preview

################################################################################
################################### 0. Setup ###################################
################################################################################

# Set random seed
set.seed(42)

# Set network
network <- intergraph::asNetwork(SNA4DSData::Sampson$Sampson_like2)

################################################################################
############################## 1. Create Network ###############################
################################################################################

### 1.1. Directed Network
survey <- data.frame(respondent = NA, alter1 = NA, alter2 = NA)

edges <- data.frame(rbind(cbind(survey$respondent, survey$alter1),
cbind(survey$respondent, survey$alter2)))
vertices <- unique(c(survey$respondent, survey$alter1, survey$alter2))
network <- igraph::graph_from_data_frame(edges, vertices, directed = TRUE)

### 1.2 Convert igraph::igraph to sna::network
intergraph::asNetwork(network)

### 1.3 Convert sna::network to igraph::igraph
intergraph::asIgraph(network)

################################################################################
############################### 2. Descriptives ################################
################################################################################

### 2.1 Print Description
igraph::print.igraph(network)

### 2.2 Print Diameter
igraph::diameter(network)

### 2.3 Print Dyad Census (???)
igraph::dyad.census(network)

### 2.4 Print Density
igraph::edge_density(network)

### 2.5 Print Reciprocity
igraph::reciprocity(network)

### 2.6 Print Transitivity
igraph::transitivity(network)
sna::gtrans(network, mode = "digraph") # digraph = directed, graph = undirected

### 2.7 Print Betweenness Centrality
igraph::centralization.betweenness(network)

### 2.8 Print Closeness Centrality
igraph::centralization.closeness(network)

### 2.9 Print Mean Distance (average path length)
igraph::mean_distance(network)

Written for

Institution
Study
Course

Document information

Uploaded on
January 3, 2022
Number of pages
7
Written in
2020/2021
Type
OTHER
Person
Unknown

Subjects

$6.06
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
tomdewildt Jheronimus Academy of Data Science
Follow You need to be logged in order to follow users or courses
Sold
29
Member since
4 year
Number of followers
13
Documents
22
Last sold
11 months ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions