You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("OlivierBinette/splinit")
Get a sample from a curve.
curve <- function(u) {
cbind(2*sin(u+1)*cos(2*u) + sin(u), cos(u)+cos(u-2.3))
}
pts = curve(2*pi*(1:100)/100) + rnorm(0, 0.02, n=200)
Find a closed curve approximation.
library(splinit)
pretty::plot(pts, xlab="", ylab="")
pretty::lines(splinit(pts))
#> Warning: executing %dopar% sequentially: no parallel backend registered