get_parent_dir: Retrieve the parent directory

Description Usage Arguments Value Examples

View source: R/others.R

Description

Use this function to retrieve the parent directory from a string representing the full path of a file or a directory.

Usage

1
get_parent_dir(pathStr)

Arguments

pathStr

string. The name of the directory, can be a full path filename.

Value

a string representing the parent directory. When a non-file path is used as input (or something along those lines :) then it returns the root ("/") directory.

Examples

1
2
3
get_parent_dir("/home/john")
get_parent_dir("/home/john/a.txt")
get_parent_dir("/home")

bblodfon/usefun documentation built on Nov. 13, 2019, 12:43 p.m.