dirSeg | R Documentation |
Computes the direction of segments from the first top clockwise (North = 0)
dirSeg(x,deg=TRUE)
x |
a matrix or data frame of 4 columns giving the coordinates of each segment tops x1, y1, x2, y2 |
deg |
if TRUE (default) the output is in degrees, otherwise in radians |
The first two colomns give the first top coordinates, x then y, and the next two the second top coordinates.
A vector of directions
dirProj
x2<-rnorm(10)
y2<-rnorm(10)
mydata<-cbind(0,0,x2,y2)
dirs<-dirSeg(mydata)
dirs
plot(range(mydata[,c(1,3)]),range(mydata[,c(2,4)]),type="n")
Segments(mydata)
text(mydata[,3],mydata[,4],paste(round(dirs,0),"\u00b0"),cex=0.7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.