| Title: | Biodiversity Assessment Using Hill-Number Functional Tools |
|---|---|
| Description: | Tools for biodiversity assessment through Hill-number diversity profiles treated as functions of the order q. The package computes the profiles of Hill (1973) <doi:10.2307/1934352>, their analytical first and second derivatives, curvature, radius of curvature, arc length, cumulative integral functions, profile areas, area-based rankings and relative changes over time, together with static and interactive three-dimensional biodiversity surfaces. The functional approach follows Di Battista, Fortuna and Maturo (2017) <doi:10.1016/j.ecolind.2016.10.032>, Maturo and Di Battista (2018) <doi:10.1016/j.ecolind.2017.08.016> and Maturo (2018) <doi:10.1016/j.ecolind.2018.03.013>. |
| Authors: | Fabrizio Maturo [aut, cre], Francesca Fortuna [aut], Tonio Di Battista [aut] |
| Maintainer: | Fabrizio Maturo <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 3.0.0 |
| Built: | 2026-10-18 18:21:41 UTC |
| Source: | https://github.com/cran/BioFTF |
Hill-number diversity profiles are treated as functions of the order
and summarised through functional tools: derivatives, curvature,
radius of curvature, arc length, cumulative integral functions, areas,
rankings, and biodiversity surfaces over time.
Rows of the input matrix are communities, sites, or time points. Columns are species. Absolute and relative non-negative abundances are both accepted, because every row is rescaled to sum to one.
The main functions are hill_profile for the profiles,
hill_derivative, hill_curvature,
hill_area, hill_cum, hill_arc and
hill_ranking for the functional tools, and
hill_surface_plot and hill_surface_compare for
static or rotatable three-dimensional surfaces.
Versions 1.x of the package computed the same functional tools on the
Patil-Taillie beta profile. The relation between the two profiles is given in
hill_profile. The function names of versions 1.x are still
available but deprecated; see BioFTF-deprecated.
Fabrizio Maturo, Francesca Fortuna, Tonio Di Battista.
Di Battista, T., Fortuna, F. and Maturo, F. (2017). BioFTF: An R package for biodiversity assessment with the functional data analysis approach. Ecological Indicators, 73, 726–732. doi:10.1016/j.ecolind.2016.10.032
Maturo, F. and Di Battista, T. (2018). A functional approach to Hill's numbers for assessing changes in species variety of ecological communities over time. Ecological Indicators, 84, 70–81. doi:10.1016/j.ecolind.2017.08.016
Maturo, F. (2018). Unsupervised classification of ecological communities ranked according to their biodiversity patterns via a functional principal component decomposition of Hill's numbers integral functions. Ecological Indicators, 90, 305–315. doi:10.1016/j.ecolind.2018.03.013
Hill, M. O. (1973). Diversity and evenness: a unifying notation and its consequences. Ecology, 54(2), 427–432. doi:10.2307/1934352
Patil, G. P. and Taillie, C. (1982). Diversity as a concept and its measurement. Journal of the American Statistical Association, 77(379), 548–561. doi:10.1080/01621459.1982.10477845
Relative abundances, species summaries, a wrapper that returns all the functional tools, and a wrapper that saves the profile plots to a PDF file.
datirel(x) summary_species(x) summary_species_relative(x) alltools(x, from = 0, to = 2, n = 101) export_plots(x, file, from = 0, to = 2, n = 101)datirel(x) summary_species(x) summary_species_relative(x) alltools(x, from = 0, to = 2, n = 101) export_plots(x, file, from = 0, to = 2, n = 101)
x |
A numeric matrix or data frame of non-negative abundances. Rows are communities, sites, or time points; columns are species. |
from, to
|
Finite lower and upper endpoints of the grid of orders. |
n |
Number of equally spaced orders. |
file |
Path of the PDF file to create. |
datirel returns the matrix of relative abundances.
summary_species returns a data frame with richness, total abundance,
and smallest and largest abundance of each community, zeros included;
summary_species_relative returns the same summaries for relative
abundances. alltools returns a list with the relative abundances, the
species summary, and the output of hill_profile,
hill_first_derivative, hill_second_derivative,
hill_curvature, hill_radius,
hill_area, hill_cum, hill_arc, and
hill_ranking. export_plots writes one page for each of
profile, first derivative, second derivative, curvature, radius of
curvature, and cumulative integral function, and invisibly returns
file.
x <- matrix(c(3, 5, 5, 2, 1, 2, 6, 8, 5, 1, 7, 3, 2, 1, 0), nrow = 3, byrow = TRUE) datirel(x) summary_species(x) summary_species_relative(x) res <- alltools(x, from = 0, to = 5, n = 251) names(res) res$ranking out <- file.path(tempdir(), "BioFTF-plots.pdf") export_plots(x, file = out) unlink(out)x <- matrix(c(3, 5, 5, 2, 1, 2, 6, 8, 5, 1, 7, 3, 2, 1, 0), nrow = 3, byrow = TRUE) datirel(x) summary_species(x) summary_species_relative(x) res <- alltools(x, from = 0, to = 5, n = 251) names(res) res$ranking out <- file.path(tempdir(), "BioFTF-plots.pdf") export_plots(x, file = out) unlink(out)
Derivatives, curvature, radius of curvature, cumulative integral functions, areas, arc lengths, rankings, and changes between consecutive rows, all computed from Hill-number profiles.
hill_derivative(x, order = 1, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_first_derivative(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_second_derivative(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_curvature(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_radius(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_area(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_cum(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_arc(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_ranking(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_total_change(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_derivative_plot(x, order = 1, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "bottomright", ...) hill_curvature_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...) hill_radius_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topleft", ...) hill_cum_plot(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE, legend = "topleft", ...)hill_derivative(x, order = 1, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_first_derivative(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_second_derivative(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_curvature(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_radius(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_area(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_cum(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_arc(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_ranking(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_total_change(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE) hill_derivative_plot(x, order = 1, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "bottomright", ...) hill_curvature_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...) hill_radius_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topleft", ...) hill_cum_plot(x, from = 0, to = 2, n = 101, domain = NULL, baseline = 0, allow_negative = FALSE, legend = "topleft", ...)
x |
A numeric matrix or data frame of non-negative abundances. Rows are communities, sites, or time points; columns are species. |
order |
Derivative order, 1 or 2. |
from, to
|
Finite lower and upper endpoints of the grid of orders. |
n |
Number of equally spaced orders used when |
domain |
Optional numeric vector of finite orders. Areas, cumulative integrals, and arc lengths require at least two strictly increasing values. |
baseline |
Constant subtracted from the profile before integration.
With |
allow_negative |
Logical. If |
legend |
Position of the legend, as accepted by
|
... |
Further arguments passed to |
Derivatives. First and second derivatives are analytical. Writing
and
, the Hill number is ,
so that and . The derivatives of
are the mean and the variance of under the
weights . Near ,
where the closed form is numerically unstable, a Taylor expansion is used.
The derivatives therefore do not depend on the spacing of the grid.
Curvature and radius. The curvature is
and the radius of curvature is its
reciprocal. Where the curvature is numerically zero (below
), as for a community whose species are equally abundant or
far along the flat tail of a profile, the radius is returned as NA.
Area and cumulative integral. hill_cum returns
,
with the baseline, at each order of the grid, and hill_area
its value at the last order. Both use the trapezoidal rule, whose error
decreases with the square of the grid spacing. With the default
n = 101 the relative error of the area is of order on
and grows with wider domains, so n should be increased
together with to.
Arc length. hill_arc returns the length of the polygonal line
through the profile. It is bounded below by to - from, attained by a
flat profile. The arc length depends on the units of both axes.
Ranking. hill_ranking reports the Hill numbers of order 0, 1,
and 2 together with area and arc length. area_rank is 1 for the
largest area. arc_rank is 1 for the shortest arc, that is, for the
flattest profile; it orders communities by how little the profile changes
along the domain and is not a ranking by diversity. A larger area does not
imply that one profile lies above the other at every order: when two
profiles cross, the communities are not ordered in an intrinsic sense and the
area ranking depends on the chosen domain. As to increases, the area
is progressively dominated by .
Change. hill_total_change compares the area of each row with
the area of the previous one, which is meaningful when rows are ordered, for
instance in time.
hill_derivative, hill_first_derivative,
hill_second_derivative, hill_curvature, hill_radius, and
hill_cum return matrices with orders in rows and communities in
columns; the exact orders are stored in the attribute "q".
hill_area and hill_arc return one-column data frames with one
row per community. hill_ranking returns a data frame with columns
richness, shannon, simpson, hill_area,
area_rank, arc_length, and arc_rank.
hill_total_change returns a data frame with columns from,
to, area_from, area_to, absolute_change, and
relative_change. Plot functions return the plotted matrix invisibly.
Di Battista, T., Fortuna, F. and Maturo, F. (2017). BioFTF: An R package for biodiversity assessment with the functional data analysis approach. Ecological Indicators, 73, 726–732. doi:10.1016/j.ecolind.2016.10.032
Maturo, F. and Di Battista, T. (2018). A functional approach to Hill's numbers for assessing changes in species variety of ecological communities over time. Ecological Indicators, 84, 70–81. doi:10.1016/j.ecolind.2017.08.016
Maturo, F. (2018). Unsupervised classification of ecological communities ranked according to their biodiversity patterns via a functional principal component decomposition of Hill's numbers integral functions. Ecological Indicators, 90, 305–315. doi:10.1016/j.ecolind.2018.03.013
hill_profile, hill_surface_plot.
x <- matrix(c(54, 20, 17, 6, 3, 25, 25, 25, 25, 0, 35, 35, 30, 0, 0), nrow = 3, byrow = TRUE) rownames(x) <- c("A", "B", "C") ## Derivatives at selected orders. hill_first_derivative(x, domain = c(0, 0.5, 1, 2)) hill_second_derivative(x, domain = c(0, 0.5, 1, 2)) head(hill_curvature(x)) ## Area, cumulative integral function, arc length, and ranking on [0, 2]. hill_area(x) tail(hill_cum(x)) hill_arc(x) hill_ranking(x) ## Area above the minimum value of a Hill number on a wider domain. hill_area(x, from = 0, to = 10, n = 1001, baseline = 1) ## Plots. hill_derivative_plot(x, order = 1) hill_curvature_plot(x) hill_cum_plot(x, from = 0, to = 10, n = 501) ## Change in area between consecutive surveys. surveys <- matrix(c(40, 30, 15, 10, 5, 35, 30, 18, 12, 5, 30, 28, 20, 15, 7, 25, 25, 22, 18, 10, 20, 24, 24, 20, 12, 15, 22, 25, 22, 16), nrow = 6, byrow = TRUE) rownames(surveys) <- 2018:2023 hill_total_change(surveys)x <- matrix(c(54, 20, 17, 6, 3, 25, 25, 25, 25, 0, 35, 35, 30, 0, 0), nrow = 3, byrow = TRUE) rownames(x) <- c("A", "B", "C") ## Derivatives at selected orders. hill_first_derivative(x, domain = c(0, 0.5, 1, 2)) hill_second_derivative(x, domain = c(0, 0.5, 1, 2)) head(hill_curvature(x)) ## Area, cumulative integral function, arc length, and ranking on [0, 2]. hill_area(x) tail(hill_cum(x)) hill_arc(x) hill_ranking(x) ## Area above the minimum value of a Hill number on a wider domain. hill_area(x, from = 0, to = 10, n = 1001, baseline = 1) ## Plots. hill_derivative_plot(x, order = 1) hill_curvature_plot(x) hill_cum_plot(x, from = 0, to = 10, n = 501) ## Change in area between consecutive surveys. surveys <- matrix(c(40, 30, 15, 10, 5, 35, 30, 18, 12, 5, 30, 28, 20, 15, 7, 25, 25, 22, 18, 10, 20, 24, 24, 20, 12, 15, 22, 25, 22, 16), nrow = 6, byrow = TRUE) rownames(surveys) <- 2018:2023 hill_total_change(surveys)
Compute and plot Hill-number diversity profiles for ecological communities, sites, or time points.
hill_profile(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_profile_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...) hill_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...)hill_profile(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE) hill_profile_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...) hill_plot(x, from = 0, to = 2, n = 101, domain = NULL, allow_negative = FALSE, legend = "topright", ...)
x |
A numeric matrix or data frame of non-negative abundances. Rows are communities, sites, or time points; columns are species. A numeric vector is treated as a single community. |
from, to
|
Finite lower and upper endpoints of the grid of orders. The
default is |
n |
Number of equally spaced orders between |
domain |
Optional numeric vector of orders at which the profile is
evaluated. When supplied, |
allow_negative |
Logical. If |
legend |
Position of the legend, as accepted by
|
... |
Further arguments passed to |
For relative abundances , the Hill number of order
is
with
defined by continuity. is species richness, is the
exponential of Shannon entropy, is the inverse Simpson
concentration, and is the
reciprocal of the Berger-Parker dominance. is expressed in
effective numbers of species and is non-increasing in ; it is constant
only when all the species present are equally abundant.
Range of the order. Most of the variation of the profile lies between
and , which is the default. Increasing to adds
the part of the curve that converges to ; the limit
itself is obtained with domain = Inf.
Negative orders. For the Hill number is larger than
species richness, so it can no longer be read as an effective number of
species out of the observed, and it is driven by the smallest
positive abundances: .
These are the abundances most affected by sampling error, and the value
changes abruptly when a rare species goes undetected. Negative orders are
therefore rejected unless allow_negative = TRUE.
Relation with the Patil-Taillie profile. Versions 1.x of the package used the beta profile of Patil and Taillie (1982),
which equals at , Shannon entropy as
, and the Gini-Simpson index at
. With the two
profiles are linked by
so the interval for corresponds to
for . The two profiles induce the same ordering of
communities at each order, but they are measured on different scales: the
beta profile is an entropy, whereas the Hill number is its numbers
equivalent. Derivatives, curvature, arc length, and areas are not invariant
to this transformation, so functional tools computed on the two profiles
differ and may rank communities differently.
hill_profile and hill return a matrix with orders in rows and
communities in columns. The exact orders are stored in the attribute
"q". Plot functions return the profile invisibly.
Hill, M. O. (1973). Diversity and evenness: a unifying notation and its consequences. Ecology, 54(2), 427–432. doi:10.2307/1934352
Patil, G. P. and Taillie, C. (1982). Diversity as a concept and its measurement. Journal of the American Statistical Association, 77(379), 548–561. doi:10.1080/01621459.1982.10477845
Di Battista, T., Fortuna, F. and Maturo, F. (2017). BioFTF: An R package for biodiversity assessment with the functional data analysis approach. Ecological Indicators, 73, 726–732. doi:10.1016/j.ecolind.2016.10.032
Maturo, F. and Di Battista, T. (2018). A functional approach to Hill's numbers for assessing changes in species variety of ecological communities over time. Ecological Indicators, 84, 70–81. doi:10.1016/j.ecolind.2017.08.016
Maturo, F. (2018). Unsupervised classification of ecological communities ranked according to their biodiversity patterns via a functional principal component decomposition of Hill's numbers integral functions. Ecological Indicators, 90, 305–315. doi:10.1016/j.ecolind.2018.03.013
hill_derivative, hill_area,
hill_surface_plot.
x <- matrix(c(54, 20, 17, 6, 3, 25, 25, 25, 25, 0, 35, 35, 30, 0, 0, 70, 10, 10, 5, 5), nrow = 4, byrow = TRUE) rownames(x) <- c("A", "B", "C", "D") ## Default grid: 101 orders between 0 and 2. p <- hill_profile(x) head(p) ## Selected orders, including the limit for q tending to infinity. hill_profile(x, domain = c(0, 1, 2, 5, 10, 100, Inf)) ## A wider domain. hill_profile_plot(x, from = 0, to = 10, n = 201) ## Negative orders exceed species richness. hill_profile(x, domain = c(-1, 0), allow_negative = TRUE)x <- matrix(c(54, 20, 17, 6, 3, 25, 25, 25, 25, 0, 35, 35, 30, 0, 0, 70, 10, 10, 5, 5), nrow = 4, byrow = TRUE) rownames(x) <- c("A", "B", "C", "D") ## Default grid: 101 orders between 0 and 2. p <- hill_profile(x) head(p) ## Selected orders, including the limit for q tending to infinity. hill_profile(x, domain = c(0, 1, 2, 5, 10, 100, Inf)) ## A wider domain. hill_profile_plot(x, from = 0, to = 10, n = 201) ## Negative orders exceed species richness. hill_profile(x, domain = c(-1, 0), allow_negative = TRUE)
Compute, plot, and compare surfaces obtained by placing the Hill-number profiles of ordered rows side by side. Plots are either rotatable or static.
hill_surface(x, from = 0, to = 2, n = 101, domain = NULL, time = NULL, allow_negative = FALSE) hill_surface_plot(x, from = 0, to = 2, n = 101, domain = NULL, time = NULL, plot = c("interactive", "static"), allow_negative = FALSE, xlab = "Order q", ylab = "Time", zlab = "Hill number", main = "Hill-number surface", theta = 40, phi = 25, ...) hill_surface_compare(x, y, from = 0, to = 2, n = 101, domain = NULL, time = NULL, labels = c("Surface 1", "Surface 2"), plot = c("interactive", "static"), mode = c("overlay", "difference"), allow_negative = FALSE, main = "Comparison of Hill-number surfaces", theta = 40, phi = 25, ...)hill_surface(x, from = 0, to = 2, n = 101, domain = NULL, time = NULL, allow_negative = FALSE) hill_surface_plot(x, from = 0, to = 2, n = 101, domain = NULL, time = NULL, plot = c("interactive", "static"), allow_negative = FALSE, xlab = "Order q", ylab = "Time", zlab = "Hill number", main = "Hill-number surface", theta = 40, phi = 25, ...) hill_surface_compare(x, y, from = 0, to = 2, n = 101, domain = NULL, time = NULL, labels = c("Surface 1", "Surface 2"), plot = c("interactive", "static"), mode = c("overlay", "difference"), allow_negative = FALSE, main = "Comparison of Hill-number surfaces", theta = 40, phi = 25, ...)
x, y
|
Numeric abundance matrices or data frames with at least two rows.
Rows are ordered time points or sites along a gradient; columns are species.
|
from, to
|
Finite lower and upper endpoints of the grid of orders. |
n |
Number of equally spaced orders used when |
domain |
Optional vector of finite, strictly increasing orders. |
time |
Optional numeric vector of strictly increasing values, one for
each row. If |
plot |
|
allow_negative |
Logical. If |
xlab, ylab, zlab, main
|
Axis labels and title. |
theta, phi
|
Viewing angles of the static plot, as in
|
labels |
Names of the two surfaces. |
mode |
|
... |
Further arguments passed to |
The surface has the order on one horizontal axis, time on the other,
and the Hill number on the vertical axis. Profiles are observed only at the
rows of the data: between two consecutive rows the surface is a linear
interpolation drawn for display, not an estimate of diversity at
intermediate times.
Interactive plots require the suggested package plotly. In the static plot the colour of each facet follows the height of the surface, and lines mark the observed profiles and a subset of the orders.
hill_surface returns a list with components q (orders),
time, and z, a matrix of Hill numbers with orders in rows and
time points in columns. With plot = "interactive",
hill_surface_plot and hill_surface_compare return a
plotly object. With plot = "static", hill_surface_plot
invisibly returns the surface, and hill_surface_compare invisibly
returns a list with the two surfaces and their difference.
Maturo, F. and Di Battista, T. (2018). A functional approach to Hill's numbers for assessing changes in species variety of ecological communities over time. Ecological Indicators, 84, 70–81. doi:10.1016/j.ecolind.2017.08.016
hill_profile, hill_total_change.
years <- 2018:2027 x <- matrix(c(40, 35, 15, 5, 5, 0, 38, 34, 16, 6, 4, 2, 35, 30, 18, 8, 5, 4, 30, 28, 20, 10, 7, 5, 25, 26, 21, 12, 9, 7, 20, 24, 22, 14, 11, 9, 16, 21, 23, 16, 13, 11, 12, 18, 24, 18, 15, 13, 9, 15, 24, 20, 17, 15, 6, 12, 23, 22, 19, 18), nrow = length(years), byrow = TRUE) rownames(x) <- years ## A second set of surveys on the same years. y <- x y[, 1] <- x[, 1] + 15 y[, 6] <- x[, 6] + 4 ## Surface between q = 0 and q = 10. s <- hill_surface(x, from = 0, to = 10, n = 121) str(s) ## Static figures. hill_surface_plot(x, from = 0, to = 10, n = 121, plot = "static") hill_surface_plot(x, from = 0, to = 10, n = 121, plot = "static", theta = 130, phi = 20, main = "Hill-number surface, 2018-2027") hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), plot = "static") hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), plot = "static", mode = "difference") ## Rotatable figures. if (interactive() && requireNamespace("plotly", quietly = TRUE)) { hill_surface_plot(x, from = 0, to = 10, n = 121) hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2")) hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), mode = "difference") }years <- 2018:2027 x <- matrix(c(40, 35, 15, 5, 5, 0, 38, 34, 16, 6, 4, 2, 35, 30, 18, 8, 5, 4, 30, 28, 20, 10, 7, 5, 25, 26, 21, 12, 9, 7, 20, 24, 22, 14, 11, 9, 16, 21, 23, 16, 13, 11, 12, 18, 24, 18, 15, 13, 9, 15, 24, 20, 17, 15, 6, 12, 23, 22, 19, 18), nrow = length(years), byrow = TRUE) rownames(x) <- years ## A second set of surveys on the same years. y <- x y[, 1] <- x[, 1] + 15 y[, 6] <- x[, 6] + 4 ## Surface between q = 0 and q = 10. s <- hill_surface(x, from = 0, to = 10, n = 121) str(s) ## Static figures. hill_surface_plot(x, from = 0, to = 10, n = 121, plot = "static") hill_surface_plot(x, from = 0, to = 10, n = 121, plot = "static", theta = 130, phi = 20, main = "Hill-number surface, 2018-2027") hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), plot = "static") hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), plot = "static", mode = "difference") ## Rotatable figures. if (interactive() && requireNamespace("plotly", quietly = TRUE)) { hill_surface_plot(x, from = 0, to = 10, n = 121) hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2")) hill_surface_compare(x, y, from = 0, to = 10, n = 121, labels = c("Area 1", "Area 2"), mode = "difference") }