On this set of exercises, we are going to explore some of the probability functions in R with practical applications. Basic probability knowledge is required. Note: We are going to use random number functions and random process functions in R such as runif, a problem with these functions is that every time you run them […]

## Probabilty functions beginner solution

Below are the solutions to these exercises on probability functions. #################### # # # Exercise 1 # # # #################### set.seed(1) random_numbers <- runif(10) #################### # # # Exercise 2 # # # #################### (coin_tosses_1 <- ifelse(random_numbers>.5, ‘head’, ‘tail’)) ## [1] “tail” “tail” “head” “head” “tail” “head” “head” “head” “head” “tail” set.seed(1) (coin_tosses <- rbinom(n […]

## Character Functions (Advanced)

This set of exercises will help you to help you improve your skills with character functions in R. Most of the exercises are related with text mining, a statistical technique that analyses text using statistics. If you find them interesting I would suggest checking the library tm, this includes functions designed for this task. There […]

## Character Functions Advanced (Solutions)

Below are the solutions to these exercises on character functions. #Run before the first exercise if (!’tm’ %in% installed.packages()) install.packages(‘tm’) library(tm) txt <- system.file(“texts”, “txt”, package = “tm”) ovid <- VCorpus(DirSource(txt, encoding = “UTF-8”), readerControl = list(language = “lat”)) TEXT <- lapply(ovid[1:5], as.character) TEXT1 <- TEXT[[4]] OVID <- c(data.frame(text=unlist(TEXT), stringsAsFactors = F))$text #################### # # […]

## Protected: Character Functions (Intermediate)

There is no excerpt because this is a protected post.

## Character Functions (Intermediate) Solutions

Below are the solutions to these exercises on character functions. #################### # # # Exercise 1 # # # #################### cat(‘Hello world!\nI\’m ready to start.’) ## Hello world! ## I’m ready to start. #################### # # # Exercise 2 # # # #################### states <- rownames(USArrests) (States <- tolower(states)) ## [1] “alabama” “alaska” “arizona” “arkansas” […]

## Protected: Character Functions

There is no excerpt because this is a protected post.

## Protected: Character Functions – solutions

There is no excerpt because this is a protected post.

## Basic Operations Exercises

This set of exercises will help you to learn and test your skill with basic arithmetical operations and logic functions. Before proceeding, it might be helpful to look over the help pages for the **, %/%, %%, and the logical operators such as !=, ==, >=, isTRUE . Answers to the exercises are available here. […]

## Basic Operations Solutions

Below are the solutions to these exercises on Basic operation. #################### # # # Exercise 1 # # # #################### S <- 100 i1 <- 0.1 i2 <- 0.09 n <- 2 simple <- S*(1 + i1*n) compound <- S*(1 + i2)**n #################### # # # Exercise 2 # # # #################### simple>compound ## [1] […]