This function mimics the
tree
shell command in Linux. It shows directories in a tree structure
as an ASCII art. Not all options were enabled.
dir_tree(path = "./", level = 3, type = "dir_last", all.files = FALSE)
path | character[1] Root path for the construction of the ASCII representation. |
---|---|
level | integer[1] A positive integer that is how many levels to
show. Default is 3. Use |
type | character[1] This is the display mode. Default is
|
all.files | logical[1] Using |
Returns the directory list as invisible.
tree()
for an implementation that calls
tree
on Linux. Also, dir()
,
list.files()
and
list.dirs()
can be useful in many
circumstances.
# NOT RUN { # Tree of your currend directory. getwd() dir_tree() dir_tree(type = "none") dir_tree(all.files = TRUE) # Tree of a installed package. dir_tree(system.file(package = "lattice"), level = 1) dir_tree(system.file(package = "lattice"), level = 2) dir_tree(system.file(package = "lattice"), level = 3) dir_tree(system.file(package = "lattice"), level = 4) m <- dir_tree(system.file(package = "MASS"), level = 2) str(m) # }