Using functions with several parameters
A function in R can have more than one parameter. In this section, we are going to get acquainted with supplying several arguments to such functions. At the same time, several new functions that take more than one argument will be introduced.
Supplying more than one argument in a function call
When specifying several arguments in a function, we need to assign each argument to the respective parameter using the usual assignment operator =
during the function call, separating the assignment expressions for different parameters with commas.
For example, let's examine the seq
function. Its most useful three parameters are from
, to
, and by
(you can see in the function's help page that it has several more parameters). The seq
function creates a sequential vector based on the input, as follows:
from
: This parameter specifies from where to beginto
: This parameter specifies where to endby
: This parameter specifies the step size
Let's take a look...