R/RcppExports.R

Defines functions split_indices asMatrixParallel asMatrix

Documented in split_indices

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

asMatrix <- function(rp, cp, z, nrows, ncols) {
    .Call('_thisutils_asMatrix', PACKAGE = 'thisutils', rp, cp, z, nrows, ncols)
}

asMatrixParallel <- function(rp, cp, z, nrows, ncols) {
    .Call('_thisutils_asMatrixParallel', PACKAGE = 'thisutils', rp, cp, z, nrows, ncols)
}

#' @title Split indices.
#'
#' @description An optimised version of split for the special case of splitting row indices into groups.
#'
#' @param group Integer indices
#' @param n The largest integer (may not appear in index).
#' This is hint: if the largest value of \code{group} is bigger than \code{n},
#' the output will silently expand.
#'
#' @return A list of vectors of indices.
#'
#' @references
#' \url{https://github.com/hadley/plyr/blob/d57f9377eb5d56107ba3136775f2f0f005f33aa3/src/split-numeric.cpp#L20}
#'
#' @export
#' @examples
#' split_indices(sample(10, 100, rep = TRUE))
#' split_indices(sample(10, 100, rep = TRUE), 10)
split_indices <- function(group, n = 0L) {
    .Call('_thisutils_split_indices', PACKAGE = 'thisutils', group, n)
}

Try the thisutils package in your browser

Any scripts or data that you put into this service are public.

thisutils documentation built on July 3, 2025, 9:09 a.m.