In this exercise, we cover some basics on frequency tables. We also briefly look at chi-square test for independence to find relationships of two variables. Before proceeding, it might be helpful to look over the help pages for the table, summary, and margin.table functions. Answers to the exercises are available here. If you obtained a […]

## Repeated measures ANOVA in R Exercises

One way, two way and n way ANOVA are used to test difference in means when we have one, two and n factor variables. A key assumption when performing these ANOVAs is that the measurements are independent. When we have repeated measures this assumption is violated, so we have to use repeated measures ANOVA. Repeated […]

## Bonus: Timeseries modelling (part 2)

We just added this week’s set of bonus exercises! Bonus exercises are weekly exercises sets, available to subscribers to our weekly newsletter. Please sign up using the form on the right, and receive further details by email how to download the bonus exercises (and solutions, of course). This and last week’s bonus exercises aim to […]

## Data frame exercises Vol. 2

[In the exercises below we cover the basics of data frames.] Answers to the exercises are available here. Exercise 1 Consider two vectors: x=seq(1,43,along.with=Id) y=seq(-20,0,along.with=Id) Create a data.frame df: >df Id Letter x y 1 1 a 1.000000 -20.000000 2 1 b 4.818182 -18.181818 3 1 c 8.636364 -16.363636 4 2 a 12.454545 -14.545455 5 […]

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

## Best practices while writing R code Exercises

How can I write R codes that other people can understand and use? In the exercises below we cover some of the best practices while writing a small piece of R code or a full automated script. These are some of the practices which should be kept in mind while coding, trust me it will […]

## If else sequences Exercises

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

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

## Bonus: Timeseries modelling (part 1)

We just added this week’s set of bonus exercises! Bonus exercises are weekly exercises sets, available to subscribers to our weekly newsletter. Please sign up using the form on the right, and receive further details by email how to download the bonus exercises (and solutions, of course). This and next week’s bonus exercises aim to […]

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