Blog Archives

Melt and cast the shape of your data.frame – Exercises

June 22, 2018
By
Melt and cast the shape of your data.frame – Exercises

  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 Related exercise sets:Spatial Data...

Read more »

Sharpening The Knives in The data.table Toolbox: Exercises

June 8, 2018
By
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() Related exercise sets:Spatial Data...

Read more »

Programmatically creating text output in R – Exercises

May 25, 2018
By
Programmatically creating text output 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 Related exercise sets:Parallel Computing...

Read more »

Create and Format a Google Sheet Within R: Exercises

May 10, 2018
By
Create and Format a Google Sheet Within R: Exercises

In this exercise set, we will practice using the Google Sheets package to create and manipulate a Google spreadsheet within R. After completing this exercise set, you will be able to prepare a basic Google Sheets document using just R, leaving behind a reproducible R-script. Note that using Google Sheets is free of cost, but Related exercise sets:Spatial Data...

Read more »

Well-Behaved Functions – Exercises

April 26, 2018
By
Well-Behaved Functions – Exercises

It is said that, in R, everything that happens is a function call. So, if we want to improve our ability to make things happen the way we want them to, maybe it’s worth getting very comfortable with how functions work in R. In this exercise set, we’ll try to gain better fluency and deepen Related exercise sets:Parallel Computing...

Read more »

K-Means Clustering in R – Exercises

April 13, 2018
By
K-Means Clustering in R – Exercises

K-means is efficient, and perhaps, the most popular clustering method. It is a way for finding natural groups in otherwise unlabeled data. You specify the number of clusters you want defined and the algorithm minimizes the total within-cluster variance. In this exercise, we will play around with the base R inbuilt k-means function on some labeled Related exercise sets:Advanced Techniques...

Read more »

Loops in R – Exercises

March 30, 2018
By
Loops in R – Exercises

Using loops is generally discouraged in R when it is possible to avoid them using vectorized alternatives. Vectorized solution are be both faster to write, read and execute – except sometimes they aren’t and the definition of vectorization isn’t always straightforward. In any event, solutions using loops can be: The fastest to prototype The easiest Related exercise sets:Scripting Loops...

Read more »

Answer probability questions with simulation (part-2)

September 20, 2017
By
Answer probability questions with simulation (part-2)

This is the second exercise set on answering probability questions with simulation. Finishing the first exercise set is not a prerequisite. The difficulty level is about the same – thus if you are looking for a challenge aim at writing up faster more elegant algorithms. As always, it pays off to read the instructions carefully Related exercise sets: Answer probability...

Read more »

Beyond the basics of data.table: Smooth data exploration

September 5, 2017
By
Beyond the basics of data.table: Smooth data exploration

This exercise set provides practice using the fast and concise data.table package. If you are new to the syntax it is recommended that you start by solving the set on the basics of data.table before attempting this one. We will use data on used cars (Toyota Corollas) on sale during 2004 in the Netherlands. There Related exercise sets: Basics of...

Read more »

Basics of data.table: Smooth data exploration

August 23, 2017
By
Basics of data.table: Smooth data exploration

The data.table package provides perhaps the fastest way for data wrangling in R. The syntax is concise and is made to resemble SQL. After studying the basics of data.table and finishing this exercise set successfully you will be able to start easing into using data.table for all your data manipulation needs. We will use data Related exercise sets: Vector exercises...

Read more »

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)