Holger von Jouanne-Diedrich shows how many ways there are to solve a problem of squares:
This time we want to solve the following simple task with R: Take the numbers 1 to 100, square them, and add all the even numbers while subtracting the odd ones!
If you want to see how to do that in at least seven different ways in R, read on!
There are many different solutions possible, making use of several aspects of the R language. So this blog post can be seen as a fun exercise to recap some of the concepts explained in our introduction to R: Learning R: The Ultimate Introduction (incl. Machine Learning!).
Give it a try and then check out the variety of solutions.