| funsRankOrderTe | R Documentation |
Two functions: rank.dist2edges.std.tri and order.dist2edges.std.tri.
rank.dist2edges.std.tri finds the ranks of the distances of points
in data, Xp, to the edges of the standard equilateral triangle
T_e=T((0,0),(1,0),(1/2,\sqrt{3}/2))
dec is a logical argument, default is TRUE,
so the ranks are for decreasing distances, if FALSE it will be
in increasing distances.
order.dist2edges.std.tri finds the orders of the distances of points
in data, Xp, to the edges of T_e.
The arguments are as in rank.dist2edges.std.tri.
rank.dist2edges.std.tri(Xp, dec = TRUE)
order.dist2edges.std.tri(Xp, dec = TRUE)
Xp |
A set of 2D points representing the data set
in which ranking in terms of the distance
to the edges of |
dec |
A logical argument
indicating the how the ranking will be performed.
If |
A list with two elements
distances |
Distances from data points to the edges of |
dist.rank |
The ranks of the data points
in decreasing distances to the edges of |
Elvan Ceyhan
#Examples for rank.dist2edges.std.tri
n<-10
set.seed(1)
Xp<-runif.std.tri(n)$gen.points
dec.dist<-rank.dist2edges.std.tri(Xp)
dec.dist
dec.dist.rank<-dec.dist[[2]]
#the rank of distances to the edges in decreasing order
dec.dist.rank
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C);
Xlim<-range(Te[,1])
Ylim<-range(Te[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(A,pch=".",xlab="",ylab="",xlim=Xlim+xd*c(-.0,.01),
ylim=Ylim+yd*c(-.01,.01))
polygon(Te)
points(Xp,pch=".")
text(Xp,labels = factor(dec.dist.rank) )
inc.dist<-rank.dist2edges.std.tri(Xp,dec = FALSE)
inc.dist
inc.dist.rank<-inc.dist[[2]]
#the rank of distances to the edges in increasing order
inc.dist.rank
dist<-inc.dist[[1]] #distances to the edges of the std eq. triangle
dist
plot(A,pch=".",xlab="",ylab="",xlim=Xlim,ylim=Ylim)
polygon(Te)
points(Xp,pch=".",xlab="",ylab="", main="",xlim=Xlim+xd*c(-.05,.05),
ylim=Ylim+yd*c(-.05,.05))
text(Xp,labels = factor(inc.dist.rank))
#Examples for order.dist2edges.std.tri
n<-10
set.seed(1)
Xp<-runif.std.tri(n)$gen.points #try also Xp<-cbind(runif(n),runif(n))
dec.dist<-order.dist2edges.std.tri(Xp)
dec.dist
dec.dist.order<-dec.dist[[2]]
#the order of distances to the edges in decreasing order
dec.dist.order
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C);
Xlim<-range(Te[,1])
Ylim<-range(Te[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(A,pch=".",xlab="",ylab="",xlim=Xlim+xd*c(-.01,.01),
ylim=Ylim+yd*c(-.01,.01))
polygon(Te)
points(Xp,pch=".")
text(Xp[dec.dist.order,],labels = factor(1:n) )
inc.dist<-order.dist2edges.std.tri(Xp,dec = FALSE)
inc.dist
inc.dist.order<-inc.dist[[2]]
#the order of distances to the edges in increasing order
inc.dist.order
dist<-inc.dist[[1]] #distances to the edges of the std eq. triangle
dist
dist[inc.dist.order] #distances in increasing order
plot(A,pch=".",xlab="",ylab="",xlim=Xlim+xd*c(-.05,.05),
ylim=Ylim+yd*c(-.05,.05))
polygon(Te)
points(Xp,pch=".")
text(Xp[inc.dist.order,],labels = factor(1:n))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.