This is the third set of exercises on networks in which we practice the functions for graph structure, using package igraph. The first and second part are available here: Part 1 Part 2 If you don’t have package already installed, install it using the following code: install.packages(“igraph”) and load it into the session using the […]

## Network Analysis Part 3 Solutions

Below are the solutions to these exercises on analysing networks. #################### # # # Exercise 1 # # # #################### d <- read.csv("http://www.r-exercises.com/wp-content/uploads/2016/10/sociogram-employees-un.csv", header=FALSE) g <- graph.adjacency(as.matrix(d), mode="undirected") V(g)$name <- LETTERS[1:NCOL(d)] V(g)$color <- "orange" V(g)$shape <- "square" E(g)$color <- "blue" E(g)$arrow.size <- 0.2 plot(g) #################### # # # Exercise 2 # # # #################### largest_cliques(g) […]

## Network Analysis Part 2 Exercises

In this set of exercises we shall practice the functions for network statistics, using package igraph.If you don’t have package already installed, install it using the following code: install.packages(“igraph”) and load it into the session using the following code: library(“igraph”) before proceeding. You can find more info about the package and graphs in general here […]

## Network Analysis Part 2 Solutions

Below are the solutions to these exercises, Network Analysis Part 2. #################### # # # Exercise 1 # # # #################### d <- read.csv("sociogram-employees-un.csv", header=FALSE) g <- graph.adjacency(as.matrix(d), mode="directed") V(g)$name <- LETTERS[1:NCOL(d)] V(g)$color <- "yellow" V(g)$shape <- "sphere" E(g)$color <- "gray" E(g)$arrow.size <- 0.2 #################### # # # Exercise 2 # # # #################### plot(g) […]

## Network Analysis Part 1 Exercises

In this set of exercises we shall create an empty graph and practice the functions for basic manipulation with vertices and edges, using the package igraph. If you don’t have the package already installed, install it using the following code: install.packages(“igraph”) and load it into the session using the following code: library(“igraph”) before proceeding. You […]

## Network Analysis Part 1 Solutions

Below are the solutions to these exercises on analysing networks. #################### # # # Exercise 1 # # # #################### g <- make_empty_graph(n=5, directed=TRUE) V(g)$color = "yellow" V(g)$shape = "sphere" #################### # # # Exercise 2 # # # #################### g <- add.edges(g, c(1,2, 1,3, 2,4, 3,4, 4,5)) #################### # # # Exercise 3 # […]

## Fundamental and Technical Analysis of Shares Exercises

In this set of exercises we shall explore possibilities for fundamental and technical analysis of stocks offered by the quantmod package. If you don’t have the package already installed, install it using the following code: install.packages(“quantmod”) and load it into the session using the following code: library(“quantmod”) before proceeding. Answers to the exercises are available […]

## Fundamental and Technical Analysis of Shares Solutions

Below are the solutions to these exercises on Fundamental and Technical analysis of shares exercises. #################### # # # Exercise 1 # # # #################### # rata fb.p <- getSymbols("FB", env=NULL) #################### # # # Exercise 2 # # # #################### Cl(to.monthly(fb.p["2015::2015-12-31"])) ## Warning: timezone of object (UTC) is different than current timezone (). ## […]

## Using MANOVA to Analyse a Banking Crisis Exercises

In this set of exercises we will practice multivariate analysis of variance – MANOVA. We shall try to find if there is a difference in the combination of export and bank reserves, depending on the status of banking sector (is there a crisis or not). The data set is fictitious and servers for education purposes […]

## Using MANOVA to analyse banking crises solutions

Below are the solutions to these exercises on Using MANOVA to analyse banking crises. #################### # # # Exercise 1 # # # #################### # read data data <- read.csv("http://www.r-exercises.com/wp-content/uploads/2016/08/banking-crises-data.csv", sep=",", header=TRUE) aggregate(. ~ crisis, data = data, FUN=function(x){sum(!is.na(x))}, na.action = na.pass) ## crisis export reserves ## 1 No 67 67 ## 2 Yes 12 […]