Fitting a principal curve to a data matrix in arbitrary dimensions.

We generate some example data:

```
t <- runif(100, -1, 1)
x <- cbind(t, t ^ 2) + rnorm(200, sd = 0.05)
colnames(x) <- c("dim1", "dim2")
plot(x)
```

A principal curve can be fit to the data as follows:

Check out `?principal_curve`

for more information on the specific outputs of `principal_curve()`

.

BUG FIX

`principal_curve()`

: avoid division by zero when the initial principal curve has already converged.BUG FIX

`project_to_curve()`

: set dimension names of outputted`s`

correctly.DOCUMENTATION: Added

`cran-comments.md`

and`revdep`

to repository.MINOR CHANGE: Removed

`adjust_range()`

; use`grDevices::extendrange()`

instead.TESTING

`start_circle()`

: Added unit tests.BUG FIX

`start_circle()`

: Make sure circle is centered and scaled correctly.MINOR CHANGE: Move smoother functions from inside

`principal_curve()`

to a list`smoother_functions`

.TESTING

`smoother_functions`

: Added tests to ensure each of the smoother functions work correctly.SPEED UP

`project_to_curve()`

: Significantly speed up this function by not allocation objects that don’t need allocation, and pre-allocating objects that do.SPEED UP

`principal_curve()`

: Added`approx_points`

parameter. This allows approximation of the curve between smoothing and projection, to ensure`principal_curve()`

scales well to higher numbers of samples.

Check NEWS.md for full list of changes.

Hastie, T. and Stuetzle, W., Principal Curves, JASA, Vol. 84, No. 406 (Jun., 1989), pp. 502-516, DOI: 10.2307/2289936 (PDF)