Datasets often arrive to us in a form that is different from what we need for our modelling or visualisations functions who in turn don’t necessary require the same format. Reshaping data.frames is a step that all analysts need but many struggle with. Practicing this meta-skill will in the long-run result in more time […]

# Exercises (intermediate)

## Non-Linear Models in R: Exercises

A mechanistic model for the relationship between x and y sometimes needs parameter estimation. When model linearisation does not work,we need to use non-linear modeling. There are three main differences between non-linear and linear modeling in R: 1. Specify the exact nature of the equation. 2. Replace the lm() with nls(), which means non-linear least […]

## Intro To Time Series Analysis – Part 2: Exercises

In the exercises below, we will explore more in the Time Series analysis. The previous exercise can be found here. Please follow this in sequence. Answers to these exercises are available here. Exercise 1 Load the AirPassengers data. Check its class and see the start and end of the series. Exercise 2 Check the cycle of […]

## Sharpening The Knives in The data.table Toolbox: Exercises

If knowledge is power, then knowledge of data.table is something of a super power, at least in the realm of data manipulation in R. In this exercise set, we will use some of the more obscure functions from the data.table package. The solutions will use set(), inrange(), chmatch(), uniqueN(), tstrsplit(), rowid(), shift(), copy(), address(), setnames() […]

## Polynomial Model in R – Study Case: Exercises

It is pretty rare to find something that represents linearity in the environmental system. The Y/X response may not be a straight line, but humped, asymptotic, sigmoidal or polynomial are possibly, truly non-linear. In this exercise, we will try to take a closer look at how polynomial regression works and practice with a study case. […]

## Intro To Time Series Analysis – Part 1: Exercises

In the exercises below, we will work with Time Series analysis and see how R can make your life easier when working with Time Series. This will be a series of Exercises and I urge you to take it in series. Please install the package and load the library before starting. Answers to these exercises […]

## Programmatically Creating Text Outputs in R: Exercises

In the age of Rmarkdown and Shiny, or when making any custom output from your data, you want your output to look consistent and neat. Also, when writing your output, you often want it to obtain a specific (decorative) format defined by the html or LaTeX engine. These exercises are an opportunity to refresh our […]

## Simple Spatial Modeling – Part 3: Exercises

So far, we have learned how to count spatial variability in our model. Please look at these two previous exercises here and here if you haven’t tried it yet. However, it only represents 1-Dimension models. In this exercise, we will try to expand our spatial consideration into a 2-Dimension model. Have a look at this […]

## Intro to FFTree: Exercises

In the exercises below, we will work with the FFTree package, which allows us to use fast and frugal decision trees to model data. Please install the package and load the library before starting. Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, […]

## Analyzing Crypto-currency Data With R – Part 1: Exercises

R provides a lot of interesting packages to analyze cryptocurrency markets. The goal of this exercise is to introduce you to one of the packages (crypto) to retrieve cryptocurrency data in R, as well as building some basic plots to understand how these markets have behaved in recent times. Cryptocurrencies are digital assets that facilitates […]