Arguments are the parameters provided to a function to perform operations in a programming language. In R programming, we can use as many arguments as we want and are separated by a comma. There is no limit on the number of arguments in a function in R. In this article, we’ll discuss different ways of adding arguments in a function in R programming.
Adding Arguments in R
We can pass an argument to a function while calling the function by simply giving the value as an argument inside the parenthesis. Below is an implementation of a function with a single argument.
 "number is divisible by 5"  "number is not divisible by 5"  "number is divisible by 5"
Adding Multiple Arguments in R
A function in R programming can have multiple arguments too. Below is an implementation of a function with multiple arguments.
 "7 is not divisible by 3"  "36 is divisible by 6"  "9 is not divisible by 2"
Adding Default Value in R
Default value in a function is a value that is not required to specify each time the function is called. If the value is passed by the user, then the user-defined value is used by the function otherwise, the default value is used. Below is an implementation of function with default value.
 "10 is divisible by 5"  "12 is divisible by 3"
Dots argument (…) is also known as ellipsis which allows the function to take an undefined number of arguments. It allows the function to take an arbitrary number of arguments. Below is an example of a function with an arbitrary number of arguments.
 "5 1 0+6i TRUE GeeksForGeeks Dots operator"
Function as Argument
In R programming, functions can be passed to another functions as arguments. Below is an implementation of function as an argument.
 55  0.2153183
- Get the List of Arguments of a Function in R Programming - args() Function
- Get Addition of the Objects passed as Arguments in R Programming - sum() Function
- Combine Arguments into a Vector in R Programming - c() Function
- Getting Multiplication of the Objects passed as Arguments in R Language - prod() Function
- How to create optional arguments for a SASS mixin?
- Scala | Named Arguments
- How to describe “object” arguments in jsdoc?
- Difference between multiple arguments and options object
- Golang program that uses func with two arguments
- Command Line Arguments in Golang
- Check if a Function is a Primitive Function in R Programming - is.primitive() Function
- Compute Density of the Distribution Function in R Programming - dunif() Function
- Apply a Function over a List of elements in R Programming - lapply() Function
- Search the Interval for Minimum and Maximum of the Function in R Programming - optimize() Function
- Compute the Natural Logarithm of the Absolute Value of Gamma Function in R Programming - lgamma() Function
- Compute the Logarithmic Derivative of the gamma Function in R Programming - digamma() Function
- Compute the Second Derivative of the Logarithmic value of the gamma Function in R Programming - trigamma() Function
- Recursively apply a Function to a List in R Programming - rapply() function
- Apply a Function over a Ragged Array in R Programming - tapply() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.