Getting ready

This recipe has two parts. The first part is to use a function on a different subset or rows or columns of a data frame. The second part of this recipe is to write a function that can call itself within the body of the function.

In the repetition part, you will calculate robust descriptive statistics for each column of a data frame, let’s say the default iris data, using the function you have written in the earlier recipe, Writing functions with multiple arguments and use of default values, in this chapter.

In the recursion part, you will write a function that can call the function itself. In this part, you will write a function to calculate the sum of a finite series such as 1^3 + 2^3 + ….. +n^3.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset