powered by
Creates ID values for the unique set of coordinates.
create.ID.coords(data, coords)
a data frame containing the spatial coordinates.
an object of class formula indicating the geographic coordinates.
formula
a vector of integers indicating the corresponding rows in data for each distinct coordinate obtained with the unique function.
data
unique
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