#' Return a list of path in the current directory within a specific regular expression.
#'
#' @author Jiaxiang Li
#'
#' @param dir directory
#' @param regex regular expression
#' @importFrom stringr str_subset str_flatten
#' @importFrom clipr write_clip
#' @export
relative_path <- function(dir = '.',regex = '.'){
list_files <-
list.files(dir) %>%
stringr::str_subset(regex) %>%
file.path(dir,.)
list_files %>%
stringr::str_flatten('\n') %>%
clipr::write_clip()
cat(
sep="\n"
,list_files
,tips()
)
return(list_files)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.