point.in.sequence
function takes numeric input vectors x
and y
or a
data.frame
object, and orders the values in such way that they are correctly sequenced by the angle subtended between each point,
and, the centroid of the total set. If the data is provided in the format of a data.frame
, then it must
containing columns named x
and y
, else an error will be thrown.point.in.sequence(x, y, ..., df = data.frame(x = x, y = y), close = FALSE)
x
valuesy
valuesx
and y
FALSE
), as to whether the set should be closed by adding (duplicating)
the first row (after ordering) to the end of the set.data.frame
object containing the re-ordered input set.x
and y
represent cartesian coordinates. This is useful if a path is sought that
passes through each point in the ordered set, however, no two lines in the total path cross over each other.
Uses the atan2
function to determine the angle (theta) between each point (x,y) and the centroid
of the data, it then orders based on increasing values of theta.