Learn R Programming

neuroim2 (version 0.8.5)

data_file_matches: Generic function to test whether a file name conforms to the given a FileFormat instance. Will test for match to data file only

Description

Validates whether a file name conforms to the data file format specification.

Usage

data_file_matches(x, file_name)

# S4 method for FileFormat,character data_file_matches(x, file_name)

Value

TRUE for match, FALSE otherwise.

Arguments

x

A FileFormat object specifying the format requirements

file_name

A character string specifying the file name to validate

Details

The function performs case-sensitive pattern matching to verify that the file name ends with the specified data extension. The match is performed using a regular expression that ensures the extension appears at the end of the file name.

See Also

file_matches, header_file_matches for related file format validation

Examples

Run this code

fmt <- new("FileFormat", header_extension = "hdr", data_extension = "img")
data_file_matches(fmt, "brain_scan.img")  # TRUE
data_file_matches(fmt, "brain_scan.hdr")  # FALSE
data_file_matches(fmt, "brain.img.gz")    # FALSE


Run the code above in your browser using DataLab