An S3 class for handling manual classification.

manual_classification(
  assignments = factor(),
  cutoff = NA_real_,
  transform = identity
)

Arguments

assignments

A factor vector of cluster assignments.

cutoff

The value used for the manual classification.

transform

A callable (function) to transform the data before applying the cutoff classification.

Value

A manual classification that behaves like a factor.

Examples

# An empty classification. manual_classification()
#> factor(0) #> Levels:
# The numeric assignments will be turned into a factor. manual_classification(c(1, 2, 1, 2, 1, 1), cutoff = 4000)
#> [1] 1 2 1 2 1 1 #> attr(,"cutoff") #> [1] 4000 #> attr(,"transform") #> function (x) #> x #> <bytecode: 0x7fd9048bf380> #> <environment: namespace:base> #> Levels: 1 2
# Provide a different function used to transform the data before # applying the cutoff. manual_classification( c("a", "a", "b", "a", "b"), cutoff = 2.5, transform = log10 )
#> [1] a a b a b #> attr(,"cutoff") #> [1] 2.5 #> attr(,"transform") #> function (x) .Primitive("log10") #> Levels: a b