Learn R Programming

imt (version 1.0.0)

validate_logical_vector: Validate a Logical Subgroup Vector

Description

This function checks if a given vector is a logical vector (TRUE/FALSE) and whether its length matches the number of rows in a specified matrix. It is designed to validate subgroup vectors used for subsettin data.

Usage

validate_logical_vector(subgroup, N, name = NULL)

Value

The original subgroup vector if it passes all validation checks.

Arguments

subgroup

A logical vector representing the subgroup to be validated.

N

Length the subgroup should have.

name

(Optional) A string indicating the name of group.

Details

This function performs two key validations:

  1. Checks if the subgroup vector is logical.

  2. Checks if the length of the subgroup vector matches the N.