hai_kmeans_user_item_tbl | R Documentation |
Takes in a data.frame/tibble and transforms it into an aggregated/normalized user-item tibble of proportions. The user will need to input the parameters for the rows/user and the columns/items.
hai_kmeans_user_item_tbl(.data, .row_input, .col_input, .record_input)
kmeans_user_item_tbl(.data, .row_input, .col_input, .record_input)
.data |
The data that you want to transform |
.row_input |
The column that is going to be the row (user) |
.col_input |
The column that is going to be the column (item) |
.record_input |
The column that is going to be summed up for the aggregation and normalization process. |
This function should be used before using a k-mean model. This is commonly referred to as a user-item matrix because "users" tend to be on the rows and "items" (e.g. orders) on the columns. You must supply a column that can be summed for the aggregation and normalization process to occur.
A aggregated/normalized user item tibble
Steven P. Sanderson II, MPH
Other Kmeans:
hai_kmeans_automl_predict()
,
hai_kmeans_automl()
,
hai_kmeans_mapped_tbl()
,
hai_kmeans_obj()
,
hai_kmeans_scree_data_tbl()
,
hai_kmeans_scree_plt()
,
hai_kmeans_tidy_tbl()
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.