representr (version 0.1.1)

clust_composite: Composite record from a cluster using a weighted average of each column values.

Description

Composite record from a cluster using a weighted average of each column values.

Usage

clust_composite(
  cluster,
  col_type,
  weights = rep(1/nrow(cluster), nrow(cluster))
)

Arguments

cluster

A data frame of the clustered records

col_type

A vector encoding the column type for each column in the dataset. Can take values in "categorical", "ordinal", "string", or "numeric"

weights

A vector of length equal to the number of records in the cluster indicating the weight for each. Defaults to equal weight.

Value

Returns the composite record from an individual cluster.

#' @examples data("rl_reg1")

clusters <- split(rl_reg1, identity.rl_reg1) type <- c("string", "string", "numeric", "numeric", "numeric", "categorical", "ordinal", "numeric", "numeric")

clust_composite(clusters[[1]], type)