R is the best programming language in the world because it encourages writing code in the order that a human would perform the steps rather than writing in nested functions.
Take the example of calculating root mean squared error, or RMSE.
Most programming languages would be written in nested functions:
Take the example of calculating root mean squared error, or RMSE.
Most programming languages would be written in nested functions:
root(mean(square(actual-expected)))
which is read as take the root of the mean of the squared of the actual minus expected. This makes the reader have to search for the inner-most function and then read it backwards to understand the calculation.
R, on the other hand, promotes writing it in the order of operations performed:
R, on the other hand, promotes writing it in the order of operations performed:
(actual-expected) -> square() -> mean() -> square_root()
which is read as first take the actual minus expected, then take the square, then take the mean, then take the square root. This allows both the writer and the reader to read the operations in the same order which the computer processes them.
If you were hearing a lecture, in which order would you want calculations explained? As each one becomes necessary, or starting with the end result and working backward to the first calculation? I'd want to start at the beginning and have each step unfold as needed. So why does so much code start with the last step first?
When I program, for my benefit and others', I want to use human-readable function names in the order in which they are being applied to the data. This is why I write in the tidyverse syntax.
If you were hearing a lecture, in which order would you want calculations explained? As each one becomes necessary, or starting with the end result and working backward to the first calculation? I'd want to start at the beginning and have each step unfold as needed. So why does so much code start with the last step first?
When I program, for my benefit and others', I want to use human-readable function names in the order in which they are being applied to the data. This is why I write in the tidyverse syntax.