Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

basename_unique

Return basenames that are unique


Description

Return basenames that are unique

Usage

basename_unique(x, path_only = FALSE)

Arguments

x

character vector; file paths

path_only

logical; if TRUE, only return the unique part of the path

Examples

files <- c("../data/glob/subdir1/test.txt", "../data/glob/subdir2/test.txt")
readtext:::basename_unique(files)
# [1] "subdir1/test.txt" "subdir2/test.txt"
readtext:::basename_unique(files, path_only = TRUE)
# [1] "subdir1" "subdir2"
readtext:::basename_unique(c("../data/test1.txt", "../data/test2.txt"))
# [1] "test1.txt" "test2.txt"

readtext

Import and Handling for Plain and Formatted Text Files

v0.80
GPL-3
Authors
Kenneth Benoit [aut, cre, cph], Adam Obeng [aut], Kohei Watanabe [ctb], Akitaka Matsuo [ctb], Paul Nulty [ctb], Stefan Müller [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.