augment_matrix_random_block: Augment Matrix with Random 2x2 Block Adjustment

View source: R/augment_matrix_random_block.R

augment_matrix_random_blockR Documentation

Augment Matrix with Random 2x2 Block Adjustment

Description

This function selects a random 2x2 block of values in the input matrix table and modifies them based on the specified delta. It checks certain conditions before applying the modifications to the selected block. The process repeats until a valid block is found or a maximum of 100 iterations is reached.

Usage

augment_matrix_random_block(table, delta)

Arguments

table

A matrix (numeric) to which the random block adjustment will be applied.

delta

A numeric value that determines the magnitude of the adjustment. If positive, values are subtracted from the block; if negative, values are added.

Value

A matrix (numeric) with the adjusted 2x2 block.

Examples

table <- matrix(1:9, 3, 3)
augment_matrix_random_block(table, 1)


covalchemy documentation built on April 12, 2025, 2:15 a.m.