Err... to R!

Err… to R! - Loops

Over, and over, and over again

Simon Wallace

7 minute read

Over, and over, and over again

Previously we created the following conditional statement: if(i < 5){ if(j < 5){ print('i and j are small') }else{ print('i is small and j is large') } }else{ if(j < 5){ print('i is large and j is small') }else{ print('i and j are large') } } To evaluate it we set individual values of i and j, however what if i and j are elements within two columns and we want to loop through every element?

Err... to R! - Conditionals

If this, then that

Simon Wallace

7 minute read

If this, then that

I, like most coders, will get frustrated at code not doing what I want it to do then blame the code for not doing what I expect it to. However the beauty, and frustration, with coding is that the code will do exactly what you tell it to do. There are times when we will want to execute a certain section of code based upon a rule, with conditionals we can tell our code to perform certain tasks in certain cases.

Err… to R! - Solving Problems

It's dangerous to go alone, take this.

Simon Wallace

8 minute read

It's dangerous to go alone, take this.

Once in a blue moon and when the stars are in alignment, a coder might write a function that operates perfectly and as expected with no bugs; usually though there is always one minor error which requires fixing. To me, this is part of coding and why it can be enjoyable as it is a problem solving exercise, and like most problem solving exercises there is a pattern and workflow that can be applied.

Simon Wallace

8 minute read

How to speak R

Now we will start to cover the basics of programming using R, starting with syntax before moving onto variables. As we shall be writing code I will provide a link where the code written here can be downloaded at the end. However as we previously covered how to create a new script, and you should have an R project already created, you can create a new script and code along as you read if you prefer.

Err… to R! - The IDE

We need somewhere to run our code.

Simon Wallace

5 minute read

The IDE is where we code, the foundation on which we build.

In order for us to be able to code we require an environment in which we can do so. This post outlines how to install R and R Studio - a recommended user interface for R - before presenting components within so you are accustomed to the R environment. Installing R In order to code in R, we first need to install it from the The Comprehensive R Archive Network (CRAN).