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...