distRef: Distance from ref

Description Usage Arguments Value Examples

View source: R/distRef.R

Description

Return the refth row of the matrix

Usage

1
distRef(X, ref, tb, tore = FALSE, toreBound = 0)

Arguments

X

Coordinates data.frame

Value

distance matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
N <- 36
X <- as.matrix(expand.grid(1:sqrt(N),1:sqrt(N)))
distRef(X,ref = 4,tb = rep(0,2),tore = TRUE,toreBound = sqrt(N))

set.seed(1)
X <- as.matrix(cbind(runif(N, min = 1,max = 3),runif(N,min = 1,max = 3)))
ref <- which.min(X[,2])
d1 <- distRef(X,ref,tb = rep(0,2),tore = TRUE,toreBound = 3)
d2 <- distRef(X,ref,tb = rep(0,2),tore = FALSE,toreBound = 0)
plot(X)
points(X[which(abs(d1- d2) > 1e-7),],pch = 16)
points(X[which(d2 < 1),],pch = 16,col = "red")

RJauslin/SystematicSampling documentation built on Feb. 10, 2021, 9:37 a.m.