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`.

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"
#> [1] "T1"
antspymm_vartype("Subject underwent rsfMRI")    # Returns "rsfMRI"
#> [1] "rsfMRI"
antspymm_vartype("DTI sequence")                # Returns "DTI"
#> [1] "DTI"
antspymm_vartype("Analysis of NM2")             # Returns "NM2DMT"
#> [1] "NM2DMT"
antspymm_vartype("Unknown type")                # Returns NA
#> [1] NA