file_matches | R Documentation |
FileFormat
instance.
Will test for match to either header file or data fileValidates whether a file name conforms to the specified FileFormat and verifies the existence of both header and data files.
file_matches(x, file_name)
## S4 method for signature 'FileFormat,character'
file_matches(x, file_name)
x |
A FileFormat object specifying the format requirements |
file_name |
A character string specifying the file name to validate |
The function performs the following validation steps:
Checks if the file name matches either the header or data format
Verifies the existence of the corresponding paired file
Returns FALSE
if either check fails
File names are validated using case-sensitive extension matching.
TRUE
for match, FALSE
otherwise.
A logical value: TRUE
if the file matches the format and both header
and data files exist, FALSE
otherwise
header_file_matches
, data_file_matches
for individual
file type checking
# Create a FileFormat for NIFTI format
fmt <- new("FileFormat",
file_format = "NIFTI",
header_encoding = "raw",
header_extension = "nii",
data_encoding = "raw",
data_extension = "nii")
# Create temporary file
tmp <- tempfile("brainscan", fileext = ".nii")
file.create(tmp)
# Check if files exist and match format
file_matches(fmt, tmp)
# Clean up
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.