min_dist {rNeighborGWAS} | R Documentation |
Calculating the minimum distance
Description
A function to calculate a Euclidian distance including at least one neighbor for all individuals.
Usage
min_dist(smap, grouping = rep(1, nrow(smap)))
Arguments
smap |
A matrix showing a spatial map for individuals. The first and second column include spatial points along an x-axis and y-axis, respectively. |
grouping |
A positive integer vector assigning each individual to a group. This argument can be useful when a "smap" contains different experimental replicates. Default setting means that all individuals are belong to a single group. |
Value
Return a scalar of the minimum Euclidian distance that allows all individuals to have at least one neighbor.
Author(s)
Yasuhiro Sato (sato.yasuhiro.36c@kyoto-u.jp)
Examples
set.seed(1)
g <- matrix(sample(c(-1,1),100*1000,replace = TRUE),100,1000)
gmap = cbind(c(rep(1,nrow(g)/2),rep(2,nrow(g)/2)),c(1:ncol(g)))
x <- runif(nrow(g),1,100)
y <- runif(nrow(g),1,100)
smap <- cbind(x,y)
grouping <- c(rep(1,nrow(g)/2), rep(2,nrow(g)/2))
pheno <- nei_simu(geno=g,smap=smap,scale=44,grouping=grouping,n_causal=50,pveB=0.4,pve=0.8)
fake_nei <- list()
fake_nei[[1]] <- g
fake_nei[[2]] <- gmap
fake_nei[[3]] <- smap
fake_nei[[4]] <- data.frame(pheno,grouping)
names(fake_nei) <- c("geno","gmap","smap","pheno")
min_s <- min_dist(fake_nei$smap, fake_nei$pheno$grouping)
[Package rNeighborGWAS version 1.2.4 Index]