endpart: endpart extracts the last part of an R path listing

View source: R/rutils.R

endpartR Documentation

endpart extracts the last part of an R path listing

Description

endpart takes a path listing and extracts the final part. This is used to find the subdirectory name into which an analysis is to be placed, or could be used to find only the filename of a file at the end of a long path. endpart automatically finds whether the user has '/' or '\\' as the section separator.

Usage

endpart(x)

Arguments

x

a character vector of the path to a subdirectory or filename

Value

the final character string - either a subdirectory or filename

Examples

first <- "C:/Users/public/Public Documents/first/"
second <- "C:\\Users\\public\\Public Documents\\second"
print(first)
print(second)
endpart(first)
endpart(second)

haddonm/codeutils documentation built on April 5, 2025, 11:29 p.m.