Book Image

Learning R for Geospatial Analysis

By : Michael Dorman
Book Image

Learning R for Geospatial Analysis

By: Michael Dorman

Overview of this book

Table of Contents (18 chapters)
Learning R for Geospatial Analysis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
External Datasets Used in Examples
Cited References
Index

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 begin

  • to: This parameter specifies where to end

  • by: This parameter specifies the step size

Let's take a look at the following...