Extract Directory Name from File or Directory Path Based on Levels
Source:R/ngr_str_dir_from_path.R
ngr_str_dir_from_path.Rd
This function retrieves the directory name at a specified level(s) above the given file path.
It wraps fs::path_dir()
to navigate up directory levels and basename()
to extract the final directory name.
Particularly useful for retrieving repo name so it can be converted to url and or html link by ngr_str_link_repo()
.
Value
character A single string representing the directory name at the specified level.
See also
Other string:
ngr_str_link_url()