Learn R Programming

condvis (version 0.5-1)

makepath: Make a default path for conditional tour

Description

Provides a default path (a set of sections), useful as input to a conditional tour (condtour). Clusters the data using k-means or partitioning around medoids (from the cluster package). The cluster centres/prototypes are then ordered to create a sensible way to visit each section as smoothly as possible. Ordering uses either the DendSer or TSP package. Linear interpolation is then used to create intermediate points between the path nodes.

Usage

makepath(x, ncentroids, ninterp = 4)

Arguments

x

A dataframe

ncentroids

The number of centroids to use as path nodes.

ninterp

The number of points to linearly interpolate between path nodes.

Value

A list with two dataframes: centers giving the path nodes, and path giving the full interpolated path.

See Also

condtour

Examples

Run this code
# NOT RUN {
d <- data.frame(x = runif(500), y = runif(500))
plot(d)
mp1 <- makepath(d, 5)
points(mp1$centers, type = "b", col = "blue", pch = 16)
mp2 <- makepath(d, 40)
points(mp2$centers, type = "b", col = "red", pch = 16)

# }

Run the code above in your browser using DataLab