R/fct_update_clust.R

Defines functions fct_update_clust

Documented in fct_update_clust

#' Update Cluster
#'
#' @param N observations
#' @param gamma posterior
#'
#' @return updated cluster assignments
#' @export
#' 
#' @import dplyr
#' @import purrr
#'
#' @examples
fct_update_clust <- function(gamma, N){
  1:N %>% 
    purrr::map_int(
      .f = function(.x){
        res <- (gamma %>% as.matrix())[.x,] %>% which.max()
      }
    )
}
alexanderjwhite/hthmixture documentation built on Sept. 4, 2022, 4:48 a.m.