assignBlocks: Assign set numbers to a vector of values.

View source: R/fcn_misc.R

assignBlocksR Documentation

Assign set numbers to a vector of values.

Description

Each set has size set_size (internally optimized using correctSetSize), holding values from 'values'. This gives n such sets and the return value is just the set index for each value.

Usage

assignBlocks(values, set_size = 5, sort_values = TRUE)

Arguments

values

Vector of values

set_size

Number of distinct values allowed in a set

sort_values

Before assigning values to sets, sort the values?

Value

Vector (same length as input) with set numbers

Examples

 #library(PTXQC)
 assignBlocks(c(1:11, 1), set_size = 3, sort_values = FALSE)
 ## --> 1 1 1 2 2 2 3 3 3 4 4 1
 

PTXQC documentation built on May 29, 2024, 9:26 a.m.