| Title: | Discrete Curvature with 'shiny' Explorer |
|---|---|
| Description: | Implements discrete curvature estimation for ordered planar point sequences using circumcenter geometry on consecutive triplets, exposed through compiled C plus plus (C++) code via 'Rcpp' for speed and numerical robustness. The package is useful for objective elbow detection in multivariate workflows, especially principal component analysis (PCA), where selecting the number of retained components can be subjective. It provides a 'shiny' interface that supports upload of raw datasets or explained-variance tables, computes Kaiser-Meyer-Olkin (KMO) sampling-adequacy diagnostics, evaluates individual and cumulative variance curves, and reports curvature- based decision rules (m* and m**) with visual summaries for reproducible component-selection decisions. References: Arney et al. (2001); Axler (2024) <doi:10.1007/978-3-031-41026-0>; Bjorklund (2019) <doi:10.1111/evo.13835>; Burden and Faires (2015); Chang et al. (2023) <https://CRAN.R-project.org/package=shiny>; Christensen (2019); Cui (2020) <doi:10.18637/jss.v040.i08>; Eddelbuettel and Sanderson (2014) <doi:10.1016/j.csda.2013.02.005>; Engelke et al. (2023) <doi:10.1016/j.jseint.2023.04.010>; Gniazdowski (2021) <doi:10.26348/znwwsi.24.35>; Haynes et al. (2017); Jameel and Al-Salami (2023) <doi:10.24086/cuejhss.v7n1y2023.pp121-125>; Jolliffe (2002); Jolliffe and Cadima (2016) <doi:10.1098/rsta.2015.0202>; Kaiser (1974); Lehnert et al. (2019) <doi:10.18637/jss.v089.i12>; Ma and Dai (2011) <doi:10.1093/bib/bbq090>; Milligan (1995); Onumanyi et al. (2022) <doi:10.3390/app12157515>; Park (2010); Revelle (2024) <https://CRAN.R-project.org/package=psych>; Rodionova et al. (2021) <doi:10.1016/j.chemolab.2021.104304>; Sen and Cohen (2025) <doi:10.1177/01466216251344288>; Serneels and Verdonck (2008) <doi:10.1016/j.csda.2007.05.024>; Shi et al. (2021) <doi:10.1186/s13638-021-01910-w>; Shaukat et al. (2016) <doi:10.1515/eko-2016-0014>; Syakur et al. (2018) <doi:10.1088/1757-899X/336/1/012017>; Wickham and Bryan (2023) <https://CRAN.R-project.org/package=readxl>; Wu et al. (2017) <doi:10.1088/1755-1315/61/1/012054>; Youssef et al. (2023) <doi:10.21303/2461-4262.2023.002582>. |
| Authors: | Aquiles Darghan [aut], Jorge Jola [aut, cre] |
| Maintainer: | Jorge Jola <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.4 |
| Built: | 2026-07-20 20:59:07 UTC |
| Source: | https://github.com/cran/Dcurvature |
Compute pointwise discrete curvature from an ordered sequence of 2D points using circumcenter-based geometry on consecutive triplets.
curvature(data)curvature(data)
data |
A numeric matrix/data frame with at least two columns representing
ordered |
A numeric vector of curvature values with one value per input row. Boundary points are set to 0.
pts <- cbind( x = seq(0, 1, length.out = 8), y = sin(seq(0, pi, length.out = 8)) ) curvature(pts)pts <- cbind( x = seq(0, 1, length.out = 8), y = sin(seq(0, pi, length.out = 8)) ) curvature(pts)
Reads ‘data.xlsx’ from the package via read_excel.
load_example_data(sheet = NULL, ...)load_example_data(sheet = NULL, ...)
sheet |
Sheet to read; passed to |
... |
Optional arguments passed to |
A data frame.
x <- load_example_data() head(x)x <- load_example_data() head(x)
Launches the discrete-curvature criterion app. You can start from an
explained-variance table (upload CSV/Excel or use the bundled example), or
from raw variables (Excel, then PCA). Elbow detection uses
curvature on the variance curves, with optional KMO in PCA mode.
run_curvature_app(..., .runApp = shiny::runApp)run_curvature_app(..., .runApp = shiny::runApp)
... |
Optional arguments passed to |
.runApp |
Internal app runner used for testing. Defaults to
|
Invisibly returns the result of shiny::runApp. Called for its
side effect of starting a Shiny app.
if (interactive()) { run_curvature_app() }if (interactive()) { run_curvature_app() }
Applies the discrete-curvature elbow criterion to an explained-variance
sequence and returns the adaptive selection (first/second-order
difference operators). When a minimum cumulative-variance threshold
tau is supplied, it also returns the extended selection
.
select_components( variance, type = c("cumulative", "individual"), axis_range = c("0p", "01"), tau = NULL )select_components( variance, type = c("cumulative", "individual"), axis_range = c("0p", "01"), tau = NULL )
variance |
Numeric vector of individual explained variance per component (percent or proportion), ordered from the first component. |
type |
Curve the criterion is applied to: |
axis_range |
Axis normalization: |
tau |
Optional minimum cumulative-variance threshold (same units as
|
This exposes, as a single reproducible call, the same logic used by the
interactive application run_curvature_app.
A list with mstar, order_used (1 or 2), mstar_ext
(NA when tau is NULL), type, axis_range,
tau, and table: a data frame with per-component
individual/cumulative variance, normalized curvature (kappa_norm) and
normalized second differences (d2_norm).
v <- c(35.2, 22.8, 15.1, 9.5, 6.2, 4.1, 2.8, 1.9, 1.3, 1.1) select_components(v, type = "cumulative", tau = 90)v <- c(35.2, 22.8, 15.1, 9.5, 6.2, 4.1, 2.8, 1.9, 1.3, 1.1) select_components(v, type = "cumulative", tau = 90)