Learn R Programming

nanny (version 0.1.8)

cluster_elements: Get clusters of elements (e.g., elements or features)

Description

cluster_elements() takes as imput a `tbl` formatted as | <element> | <feature> | <value> | <...> | and identify clusters in the data.

Usage

cluster_elements(
  .data,
  .element,
  .feature,
  .value,
  method,
  of_elements = TRUE,
  transform = NULL,
  action = "add",
  ...
)

# S4 method for spec_tbl_df cluster_elements( .data, .element, .feature, .value, method, of_elements = TRUE, transform = NULL, action = "add", ... )

# S4 method for tbl_df cluster_elements( .data, .element, .feature, .value, method, of_elements = TRUE, transform = NULL, action = "add", ... )

Arguments

.data

A `tbl` formatted as | <element> | <feature> | <value> | <...> |

.element

The name of the element column (normally elements).

.feature

The name of the feature column (normally features)

.value

The name of the column including the numerical value the clustering is based on (normally feature value)

method

A character string. The cluster algorithm to use, ay the moment k-means is the only algorithm included.

of_elements

A boolean. In case the input is a nanny object, it indicates Whether the element column will be element or feature column

transform

A function to use to tranforma the data internalli (e.g., log1p)

action

A character string. Whether to join the new information to the input tbl (add), or just get the non-redundant tbl with the new information (get).

...

Further parameters passed to the function kmeans

Value

A tbl object with additional columns with cluster labels

A tbl object with additional columns with cluster labels

A tbl object with additional columns with cluster labels

Details

maturing

identifies clusters in the data, normally of elements. This function returns a tibble with additional columns for the cluster annotation. At the moment only k-means clustering is supported, the plan is to introduce more clustering methods.

Examples

Run this code
# NOT RUN {

   cluster_elements(mtcars_tidy, car_model, feature, value, method="kmeans",	centers = 2)

# }

Run the code above in your browser using DataLab