hai_kmeans_obj {healthyR.ai} | R Documentation |
K-Means Object
Description
Takes the output of the hai_kmeans_user_item_tbl()
function and applies the
k-means algorithm to it using stats::kmeans()
Usage
hai_kmeans_obj(.data, .centers = 5)
kmeans_obj(.data, .centers = 5)
Arguments
.data |
The data that gets passed from |
.centers |
How many initial centers to start with |
Details
Uses the stats::kmeans()
function and creates a wrapper around it.
Value
A stats k-means object
Author(s)
Steven P. Sanderson II, MPH
See Also
Other Kmeans:
hai_kmeans_automl()
,
hai_kmeans_automl_predict()
,
hai_kmeans_mapped_tbl()
,
hai_kmeans_scree_data_tbl()
,
hai_kmeans_scree_plt()
,
hai_kmeans_tidy_tbl()
,
hai_kmeans_user_item_tbl()
Examples
library(healthyR.data)
library(dplyr)
data_tbl <- healthyR_data %>%
filter(ip_op_flag == "I") %>%
filter(payer_grouping != "Medicare B") %>%
filter(payer_grouping != "?") %>%
select(service_line, payer_grouping) %>%
mutate(record = 1) %>%
as_tibble()
hai_kmeans_user_item_tbl(
.data = data_tbl,
.row_input = service_line,
.col_input = payer_grouping,
.record_input = record
) %>%
hai_kmeans_obj()
[Package healthyR.ai version 0.1.0 Index]