There is a quote that I came across at the Science Museum and has quickly become my new favourite:
Everyone knows that numbers are thoroughly unsuitable for spreading statistical knowledge.
- Marie Reidemeister
Whilst tables have their place in conveying information, they should be used sparingly and only when necessary. Through effective visualisation and reporting we enable the easy digestion and understanding of our analysis.
The biggest complaint I hear about learning R is that it has a steep learning curve and I can understand where that view comes from. This post is going to be one of the longest in the series and potentially one of the hardest however we are going to try to introduce the points in a way that makes this curve easier to handle.
More variables In a previous post we introduced the variable types:
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?
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.
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.