R/order_indices.R

Defines functions order_indices

Documented in order_indices

#' order_indices
#'
#' Tweak of `dplyr`'s group_indices allowing for retaining the original order.
#'
#' @param x Vector to create group indices from.
#'
#' @return Numeric indices for input group variable.
#'
#' @export
#'
#' @examples
#' \dontrun{
#'
#' }
#'

order_indices <- function(x) {

  dplyr::group_indices(.,
                       factor(x,
                              levels = unique(x)))

}
toddellis/miao documentation built on June 1, 2025, 10:11 p.m.