jitterDupCoords

0th

Percentile

Jitters (duplicated) coordinates.

Jitters 2D coordinates uniformily on a region around (duplicated) points.

Keywords
manip, spatial
Usage
jitter2d(coords, max, min = 0.2 * max, fix.one = TRUE,
         which.fix = c("random", "first", "last")) 

jitterDupCoords(x, ...)

# S3 method for default jitterDupCoords(x, ...)

# S3 method for geodata jitterDupCoords(x, ...)

Arguments
x, coords

a matrix or data frame with 2D coordinates or geodata object.

max

numeric scalar defining maximum jittering distance.

min

numeric scalar defining minimum jittering distance.

fix.one

logical. Whether or not one of the coordinates should not be jittered.

which.fix

single element vector of integer or character, defining which coordinate won't be jittered. Only used if fix.one=TRUE.

arguments passed to jitter2d.

Value

jitter2d returns an object of the same type fo the input with jittered values

jitterDupCoords returns an object of the same type fo the input with jittered coordinate values only at the duplicated locations

See Also

dup.coords, duplicated.geodata for functions identifying duplicated locations.

Aliases
  • jitterDupCoords
  • jitterDupCoords.default
  • jitterDupCoords.geodata
  • jitter2d
Examples
# NOT RUN {
## simulating data
dt <- grf(30, cov.p=c(1, .3)) 
dt$coords <- round(dt$coords, dig=2)
## "forcing" some duplicated locations
dt$coords[4,] <- dt$coords[14,] <- dt$coords[24,] <- dt$coords[2,]
dt$coords[17,] <- dt$coords[23,] <- dt$coords[8,]

## jittering a matrix of duplicated coordinates
dt$coords[c(2,4,14,24),]
jitter2d(dt$coords[c(2,4,14,24),], max=0.01)

## jittering only the duplicated locations and comparing with original
cbind(dt$coords, jitterDupCoords(dt$coords, max=0.01))

## creating a now geodata object jittering the duplicated locations of the original one:
dup.coords(dt)
dt1 <- jitterDupCoords(dt, max=0.01)
dup.coords(dt1)
# }
Documentation reproduced from package geoR, version 1.8-1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.