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

cluster_elementsR Documentation

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

Description

cluster_elements() takes as input 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",
  ...
)

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

## S3 method for class '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). Only if method==\"gate\" this should be of length two. E.g., c\(dim1, dim2\)

.value

The name of the column including the numerical value the clustering is based on (normally feature value). Only if method==\"gate\" this should be undefined.

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 transform the data internally (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 either to the function stats::kmeans if method == \"kmeans\", dbscan::dbscan if the method == \"SNN\" or tidygate::gate if the method == \"gate\". For gate you can pass: aesthetics for the scatter plot \(including .color, .size, .shape\) and the number of gates (how_many_gates). You can also pass a gate list (see tidygate manual) for programmatic gate selection.

Details

\lifecycle

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.

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

Examples



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


stemangiola/nanny documentation built on July 29, 2023, 1:23 a.m.