Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

merge

Merge a Spatial* object having attributes with a data.frame


Description

Merge a Spatial object having a data.frame (i.e. merging of non-spatial attributes).

Usage

## S4 method for signature 'Spatial,data.frame'
merge(x, y, by = intersect(names(x), names(y)),
 by.x = by, by.y = by, all.x = TRUE, suffixes = c(".x",".y"),
 incomparables = NULL, duplicateGeoms = FALSE, ...)

Arguments

x

object deriving from Spatial

y

object of class data.frame, or any other class that can be coerced to a data.frame with as.data.frame

by, by.x, by.y

specifications of the common columns. See 'Details' in (base) merge.

all.x

logical; if TRUE, then the returned object will have all rows of x, even those that has no matching row in y. These rows will have NAs in those columns that are usually filled with values from y

suffixes

character(2) specifying the suffixes to be used for making non-by names() unique.

incomparables

values which cannot be matched. See match.

duplicateGeoms

logical; if TRUE geometries in x are duplicated if there are multiple matches between records in x and y

...

arguments to be passed to or from methods.

Value

a Spatial* object

Author(s)

Robert J. Hijmans

See Also


sp

Classes and Methods for Spatial Data

v1.4-5
GPL (>= 2)
Authors
Edzer Pebesma [aut, cre], Roger Bivand [aut], Barry Rowlingson [ctb], Virgilio Gomez-Rubio [ctb], Robert Hijmans [ctb], Michael Sumner [ctb], Don MacQueen [ctb], Jim Lemon [ctb], Finn Lindgren [ctb], Josh O'Brien [ctb], Joseph O'Rourke [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.