strip_extension | R Documentation |
FileFormat
instance.Removes the file extension from a given file name based on the FileFormat specifications.
strip_extension(x, file_name)
## S4 method for signature 'FileFormat,character'
strip_extension(x, file_name)
x |
A FileFormat object specifying the format requirements |
file_name |
A character string specifying the file name to strip the extension from |
The function performs the following steps:
If the file_name matches the header file format, it removes the header extension.
If the file_name matches the data file format, it removes the data extension.
If the file_name doesn't match either format, it throws an error.
file_name without extension
A character string representing the file name without the extension
header_file
, data_file
for related file name
manipulation
## Not run:
fmt <- new("FileFormat", header_extension = "hdr", data_extension = "img")
strip_extension(fmt, "brain_scan.hdr") # Returns "brain_scan"
strip_extension(fmt, "brain_scan.img") # Returns "brain_scan"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.