There are 5 important basic data structures in R: vector, matrix, array, list and dataframe. They can be 1-dimensional (vector and list), 2-dimensional (matrix and data frame) or multidimensional (array). They also differ according to homogeneity of elements they can contain: while all elements contained in vector, matrix and array must be of the same […]

## Data Structures Solutions

Below are the solutions to these exercises on data structures. #################### # # # Exercise 1 # # # #################### v <- sample(-100:100, 10, replace=TRUE) #################### # # # Exercise 2 # # # #################### a <- array(seq(from = 26, length.out = 25, by = 2), c(5, 5)) s <- LETTERS[match("C", LETTERS):(match("C", LETTERS)+19)] #################### # […]

## Protected: Student’s Achievement Research Project – Exercises

There is no excerpt because this is a protected post.

## Protected: Student’s Achievement Research Project – Solutions

There is no excerpt because this is a protected post.

## String Manipulation – Exercises

In this set of exercises we will practice functions that enable us to manipulate strings.You can find more about string manipulation functions in Handling and Processing Strings in R e-book. Answers to the exercises are available here. If you have different solution, feel free to post it. Exercise 1 Load text from the file and […]

## String Manipulation – Solutions

Below are the solutions to these exercises on functions that are used to manipulate strings. #################### # # # Exercise 1 # # # #################### gambler <- readLines("http://r-exercises.com/wp-content/uploads/2016/11/gambler.txt") noquote(gambler) ## [1] At length I returned from two weeks leave of absence to find that my patrons had arrived three days ago in Roulettenberg. I received […]

## Nonparametric Tests Exercises

In this set of exercises you will be presented with real-life problems in marketing. Your task will be to choose appropriate nonparametric statistical technique and solve the problem using appropriate R functions. Answers to the exercises are available here. Exercise 1 A company wants to learn if sales income is equaly distributed among the stores. […]

## Nonparametric Tests Solutions

Below are the solutions to these exercises on nonparametric tests. #################### # # # Exercise 1 # # # #################### # Chi-square goodness of fit # H0: f1=f2=f3=f4=f5=f6=f7=f8 # H1: f1!=f2 chisq.test(c(102, 300, 102, 100, 205, 105, 71, 92)) ## ## Chi-squared test for given probabilities ## ## data: c(102, 300, 102, 100, 205, 105, […]

## Network Analysis Part 3 Exercises

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://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) […]