Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion Assignment 3.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ plot(g,layout=layout.fruchterman.reingold, vertex.color=VERTEX$gender)

plot(g,layout=layout.fruchterman.reingold, vertex.color=VERTEX$gender, edge.width=EDGE$count)

````
```

## Part II

Expand All @@ -117,6 +117,30 @@ Once you have done this, also [look up](http://igraph.org/r/) how to generate th
* Betweeness centrality and dregree centrality. **Who is the most central person in the network according to these two metrics? Write a sentence or two that describes your interpretation of these metrics**

* Color the nodes according to interest. Are there any clusters of interest that correspond to clusters in the network? Write a sentence or two describing your interpetation.
```{r}
library(tidyr)
library(dplyr)
library(stringr)
library(igraph)

C1 <- read.csv("hudk4050-classes.csv",stringsAsFactors = FALSE, header = TRUE)
C2 <- C1
colnames(C2) <- C2[1,]
C2 <- slice(C2, 3:49)
C2 <- select (C2,1:8)
C2 <- unite(C2,"name", 'First Name', 'Last Name', sep=" ")
C2$name <- str_replace(C2$name, "'","")
C2$name <- str_to_title(C2$name)
C2 <- C2 %>% mutate_at(2:7,str_replace_all," ","")
C3 <- C2 %>% gather(label, class, 2:7, na.rm=TRUE,convert=FALSE) %>% select(name,class)
C3$count <- 1
C3 <- filter(C3,class!="")
C3 <- unique(C3)
C3 <- spread(C3,class,count)
rownames(C3) <- C3$name
C3 <- select (C3,-name,-HUDK4050)
C3[is.na(C3)] <- 0
```

### To Submit Your Assignment

Expand Down
Loading