#' Display the directory tree
#'
#' This function helps users to get the directory tree structure.
#'
#' @param path The directory you want to dig.
#' @param ignore ignore the directory in regular expression, by default, 'git'
#' @return data.frame
#' @author Jiaxiang Li
#'
#' @importFrom stringr str_subset
#' @import tibble
#' @importfrom dplyr filter mutate
#' @import data.tree
#' @export
tree <- function(path='.',ignore='git'){
list.dirs(path) %>%
tibble::as_tibble() %>%
dplyr::filter(!value %in% stringr::str_subset(value,ignore)) %>%
dplyr::mutate(pathString = value) %>%
# 必须按这个命名,as.Node()才能识别
# mutate(info = map_dbl(value,file.size))
# 之后再考虑加功能
data.tree::as.Node()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.