antspymm_vartype: Determine the Variable Type Based on Its Name

View source: R/multiscaleSVDxpts.R

antspymm_vartypeR Documentation

Determine the Variable Type Based on Its Name

Description

This function inspects the input character vector for specific patterns indicating the type of variable (e.g., "T1", "rsfMRI", "DTI", "NM2") and returns a corresponding string identifier for the first matched type. If no known pattern is found, it returns 'NA'.

Usage

antspymm_vartype(x)

Arguments

x

A character vector containing names or identifiers to be checked against known patterns for variable types. It must be a character vector.

Value

A character string indicating the type of variable matched based on the predefined patterns ("T1", "rsfMRI", "DTI", "NM2DMT"). Returns 'NA' if no pattern matches.

Note

This function only checks for the first occurrence of a pattern and does not account for multiple different patterns within the same input. The order of pattern checking is fixed and may affect the result if multiple patterns are present.

Examples

antspymm_vartype("This is a T1 weighted image")  # Returns "T1"
antspymm_vartype("Subject underwent rsfMRI")    # Returns "rsfMRI"
antspymm_vartype("DTI sequence")                # Returns "DTI"
antspymm_vartype("Analysis of NM2")             # Returns "NM2DMT"
antspymm_vartype("Unknown type")                # Returns NA


stnava/ANTsR documentation built on April 13, 2025, 4:10 a.m.