Learn R Programming

PrevMap (version 1.5.4)

create.ID.coords: ID spatial coordinates

Description

Creates ID values for the unique set of coordinates.

Usage

create.ID.coords(data, coords)

Arguments

data

a data frame containing the spatial coordinates.

coords

an object of class formula indicating the geographic coordinates.

Value

a vector of integers indicating the corresponding rows in data for each distinct coordinate obtained with the unique function.

Examples

Run this code
# NOT RUN {
x1 <- runif(5)
x2 <- runif(5)
data <- data.frame(x1=rep(x1,each=3),x2=rep(x2,each=3))
ID.coords <- create.ID.coords(data,coords=~x1+x2)
data[,c("x1","x2")]==unique(data[,c("x1","x2")])[ID.coords,]

# }

Run the code above in your browser using DataLab