dir_tree: Shows directories content as an ASCII tree graph

Description Usage Arguments Value Author(s) See Also Examples

View source: R/dir_tree.R

Description

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.

Usage

1
dir_tree(path = "./", level = 3, type = "dir_last", all.files = FALSE)

Arguments

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 Inf to not limit.

type

character[1] This is the display mode. Default is "dir_last" that keeps files at the beginning and directories to the end. The value "none" uses alphabetical order..

all.files

logical[1] Using TRUE, hidden files and directories are showed.

Value

Returns the directory list as invisible.

Author(s)

Walmes Zeviani, walmes@ufpr.br.

See Also

tree() for an implementation that calls tree on Linux. Also, dir(), list.files() and list.dirs() can be useful in many circumstances.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

## End(Not run)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.