The purpose of this work is to have the segmentr
to be as accessible as possible.
Because of that, extra care was put into making it easy to install and use.
Given the algorithms and their applications discussed in [@base-paper],
the segmentr
package for R is proposed to help researchers segment their
data sets. Installation can be done using the default install.packages
command,
as shown below.
install.packages("segmentr")
The package can be used with [segment()]. It takes a data
argument containing a bi-dimensional matrix
in which the rows represent different samples and the columns represent the comprehension of the data set
we wish to segment. The function also accepts an algorithm
argument, which can be exact
, hierarchical
or hybrid
, that specifies the type of algorithm will be used when exploring the data set. Finally, it's
also necessary to specify a cost
function as an argument, as it is used to compare and pick segments
that are better fit according to the given cost's chosen criteria.
library("segmentr") data <- rbind( c(1, 1, 0, 0, 0, 1023, 134521, 12324), c(1, 1, 0, 0, 0, -20941, 1423, 14334), c(1, 1, 0, 0, 0, 2398439, 1254, 146324), c(1, 1, 0, 0, 0, 24134, 1, 15323), c(1, 1, 0, 0, 0, -231, 1256, 13445), c(1, 1, 0, 0, 0, 10000, 1121, 331) ) segment( data, algorithm = "exact", cost = function(X) -multivariate(X) + 0.01*exp(ncol(X)) )
Also, a vignette version of Chapter \@ref(real-data-examples) is provided, and the user of the package can open it directly in R with embedded code examples and follow along with the analysis of the data set.
vignette("segmentr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.