Geospatial Modelling Environment

paste (Paste)

Concatenates a list of values and/or variables to create a text string


This function is designed to be embedded within other command text. It creates new strings (text) based on a variety of inputs you define. Those inputs can be other strings (in quotes), numbers (in quotes or not in quotes), index variables from a for loop, or variables that you have defined.

The optional 'sep' argument allows you to define the separator to use between the components. By default this is nothing, but if you are constructing a comma delimited list you would chance this to sep="," for instance.

This paste function is very similar to the paste function in R.


paste(..., [sep]);

...a comma delimited list of components from which the new string is constructed
[sep]defines the separator character to use between the components in the list (default is no seperator); e.g. to construct a comma delimited list specify sep=","


wd <- "C:\data\"

paste(wd, "image", i, ".img")

Assuming this paste function is embedded in a command occurring within a for(i in 1:3){...} loop, and the 'wd' variable has previously been defined, the following strings would result in each of the three loops:





Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn