Creating a Function in R Programming
Functions are created in R by using the command function(). The general structure of the function file is as follows:
Note: In the above syntax f is the function name, this means that you are creating a function with name f which takes certain arguments and executes the following statements.
Functions in R Programming
A function accepts input arguments and produces the output by executing valid R commands that are inside the function.
Functions are useful when you want to perform a certain task multiple times.
In R Programming Language when you are creating a function the function name and the file in which you are creating the function need not be the same and you can have one or more functions in R.
Contact Us