Publications by r-exercises
Conditional execution exercises
In the exercises below we cover the basics of conditional execution. In all previous exercises, the solutions required one or more R statements that were all executed consecutively. In this series of exercises we’re going to use the if, else and ifelse functions, to execute only a subset of the R script, depending on one or more conditions. Bef...
2076 sym 2 img
functions exercises
Today we’re practising functions! In the exercises below, you’re asked to write short R scripts that define functions aimed at specific tasks. The exercises start at an easy level, and gradually move towards slightly more complex functions. Answers to the exercises are available here. If you obtained a different solution than the one posted ...
1961 sym 2 img
Mode exercises
In the exercises below we cover the basics of R object modes. Understanding mode is important, because mode is a very basic property of any R object. Practically, you’ll use the mode property often to convert e.g. a character vector to a numeric vector or vice versa. Before proceeding, first read section 3.1 of An Introduction to R, and the hel...
2777 sym 2 img
Practical uses of R object modes: some examples
One of our readers commented on our mode exercises post: “What real world tasks are you using mode to solve?” I think it’s an interesting question, from a somewhat larger perspective. Obviously, it’d be a waste of time to learn all kinds of obscure commands that don’t have a clear application in the real world. Fortunately, that’s not...
3991 sym R (942 sym/8 pcs) 2 img
Bind exercises
Binding vectors, matrices and data frames using rbind and cbind is a common R task. However, when dimensions or classes differ between the objects passed to these functions, errors or unexpected results are common as well. Sounds familiar? Time to practice! Answers to the exercises are available here. Exercise 1 Try to create matrices from the ve...
3527 sym 2 img
Get-your-stuff-in-order exercises
In the exercises below we cover the basics of ordering vectors, matrices and data frames. We consider both column-wise and row-wise ordering, single and multiple variables, ascending and descending sorting, and sorting based on numeric, character and factor variables. Before proceeding, it might be helpful to look over the help pages for the sort...
2656 sym 2 img
Start here to learn R!
Ready, set, go! On R-exercises, you will find hundreds of exercises that will help you to learn R. We’ve bundled them into exercise sets, where each set covers a specific concept or function. An exercise set typically contains about 10 exercises, progressing from easy to somewhat more difficult. In order to give you a full picture of all the a...
2647 sym 2 img
Higher Order Functions Exercises
Higher order functions are functions that take other functions as arguments or return functions as their result. In this set of exercises we will focus on the former. R has a set of built-in higher order functions: Map, Reduce, Filter, Find, Position, Negate. They enable us to complete complex operations by using simple single-purpose functions a...
3947 sym 2 img
Big Salaries, Recommendation Systems, and Where We’ll Be 5 Years from Now
To stay on top of R in the news, we’re sharing some stories related to R published last week. Why Data Science ‘Rock Stars’ Earn Big Salaries (Dennis McCafferty) Recent post and slide deck related to the 2016 Data Science Salary Survey (O’Reilly Media), with R mentioned as one of the high-demand programming languages (next to SQL and Pyth...
2248 sym 2 img
January Update R Course Finder: Shiny, Quantitative Trading, and Much More
A few months ago we launched R Course Finder, an online directory that helps you to find the right R course quickly. With so many R courses available online, we thought it was a good idea to offer a tool that helps people to compare these courses, before they decide where to spend their valuable time and (sometimes) money. If you haven’t looked...
3054 sym 2 img