| dist.point2set | R Documentation | 
Returns the Euclidean distance between a point p
and set of points Yp and the
closest point in set Yp to p.
Distance between a point and a set is by definition the distance
from the point to the closest point in the set.
p should be of finite dimension and Yp should
be of finite cardinality and p
and elements of Yp must have the same dimension.
dist.point2set(p, Yp)
p | 
 A   | 
Yp | 
 A set of   | 
A list with the elements
distance | 
 Distance from point   | 
ind.cl.point | 
 Index of the closest point in set   | 
closest.point | 
 The closest point
in set   | 
Elvan Ceyhan
dist.point2line and dist.point2plane
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C);
dist.point2set(c(1,2),Te)
X2<-cbind(runif(10),runif(10))
dist.point2set(c(1,2),X2)
x<-runif(1)
y<-as.matrix(runif(10))
dist.point2set(x,y)
#this works, because x is a 1D point, and y is treated as a set of 10 1D points
#but will give an error message if y<-runif(10) is used above
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.