Answers to the exercises are available here. Exercise 1 What is the output of: ifelse(sqrt(9)<2,sqrt(9),0) Exercise 2 What is the output of: ifelse(sqrt(100)>9,sqrt(100),0) Exercise 3 What is the output y of: x=12 if(is.numeric(x)) y=x*2 Exercise 4 What is the output x,y of: z=-1 if(z<0){x=abs(z);y=z*3} Exercise 5 What is the output y of: z=6 if(z<0) y=z*3 […]

# Exercises

## Descriptive Analytics-Part 4 : Data Manipulation

Descriptive Analytics is the examination of data or content, usually manually performed, to answer the question “What happened?”. In order to be able to solve this set of exercises you should have solved the part 0, part 1, part 2 ,and part 3 of this series but also you should run this script which contain […]

## 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. […]

## Generating Data Exercises

Let’s make data R is good a making simulated data sets. These data sets are useful for learning programming. Instead of having to spend all your time cleaning up your data you have data ready to use for learning how to program. The data that will be generated here will be about cats, toys and […]

## Vectors Vol. 2 Exercises

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 Consider two vectors, x, y x=c(4,6,5,7,10,9,4,15) y=c(0,10,1,8,2,3,4,1) What is the value of: x*y Exercise 2 Consider two vectors, a, b a=c(1,2,4,5,6) b=c(3,2,4,1,9) What is the value of: cbind(a,b) Exercise […]

## Sampling Exercise Part 1

In this Exercise, we will dive quickly through some basic sampling methods. Follow along this series to use these methods later for our decision trees modelling exercise. We will sample using the package caTools and caret. This is a beginner level exercise. Please refer to the help section for set.seed(), sample.split(),createDataPartition(), and createFolds() functions. You […]

## Descriptive Analytics-Part 3 : Outlier treatment

Descriptive Analytics is the examination of data or content, usually manually performed, to answer the question “What happened?”. In order to be able to solve this set of exercises you should have solved the part 0 and’part 1 , and part 2 of this series but also you should run this script which contain some […]

## Regular Sequences Vol. 2 Exercises

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 if x <- c(a = 1, b = 2,c=3,d=4) What is the output for the code: seq(5,11,along.with =x) Exercise 2 If x= seq(4,12,4) , what is the output for […]

## Descriptive Analytics-Part 2 : Data Imputation

Descriptive Analytics is the examination of data or content, usually manually performed, to answer the question “What happened?”. In order to be able to solve this set of exercises you should have solved the part 0 and’part 1 of this series, in case you haven’t you can find the solutions to run them in your […]

## Regular Expressions Exercises – Part 1

A common task performed during data preparation or data analysis is the manipulation of strings. Regular expressions are meant to assist in such and similar tasks. A regular expression is a pattern that describes a set of strings. Regular expressions can range from simple patterns (such as finding a single number) thru complex ones (such […]