Introduction

A function in R is a set of instructions to do a certain task based on the input provided. There are lots of default functions in R to carry out data processing, analysis, and visualization tasks. However, you might require your own customized function to carry out a task that is not available within the default functions, for example, you are proposing a new algorithm to detect extreme values from a dataset and the algorithm is not yet available as a default function or not yet available as an R library. In this situation, you must write your own function, giving all the instructions to your algorithm to carry out extreme value detection task.

There are default R functions available to carry out descriptive statistical analysis such as calculating mean, standard deviation, median, and other similar values. However, you may be in a situation where you want all the values over many groups. You could do this task by performing individual calculation for each group separately, but it will be time consuming. To do the same task efficiently, a customized function could be very useful.

In this chapter, you will write your own customized function and learn how to work with input and output.

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

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