fileName: Extract File Base Name Without Extension From File Path or...

View source: R/utilsFiles.R

fileNameR Documentation

Extract File Base Name Without Extension From File Path or URL

Description

This function takes a file path or URL and returns the base name of the file without its extension. Unlike basename from base R, which returns the file name with the extension, this function directly provides just the base name, making it easier to manipulate or compare file names.

Usage

fileName(text)

Arguments

text

Character. The full path or URL of the file.

Value

Character. The base name of the file without the extension.

Examples

fileName("path/to/file.txt")  # Returns "file" instead of "file.txt"
fileName("https://example.com/file.csv")  # Returns "file" instead of "file.csv"


Epiconcept-Paris/STRAP-epiuf documentation built on Aug. 5, 2024, 3:41 a.m.